source: CIVL/examples/languageFeatures/dynamicStruct.cvl@ a389857

main test-branch
Last change on this file since a389857 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 492 bytes
Line 
1/* Commandline execution:
2 * civl verify dynamicStruct.cvl
3 * */
4#include <civlc.cvh>
5
6void f(int n) {
7 int sum;
8 $proc fp = $proc_null;
9 typedef struct foo {
10 int sum;
11 int bar[n];
12 } foo;
13
14 foo s;
15 sum = (n * (n - 1)) / 2;
16 if (n > 1) {
17 fp = $spawn f(n-1);
18 }
19 s.sum = 0;
20 for (int i = 0; i < n; i++) {
21 s.bar[i] = i;
22 s.sum += s.bar[i];
23 }
24 $assert(sum == s.sum);
25 if(fp != $proc_null) $wait(fp);
26}
27
28void main() {
29 $proc fp = $spawn f(3);
30
31 $wait(fp);
32}
Note: See TracBrowser for help on using the repository browser.