main
test-branch
| Line | |
|---|
| 1 | /* Commandline execution:
|
|---|
| 2 | * civl verify dynamicStruct.cvl
|
|---|
| 3 | * */
|
|---|
| 4 | #include <civlc.cvh>
|
|---|
| 5 |
|
|---|
| 6 | void 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 |
|
|---|
| 28 | void main() {
|
|---|
| 29 | $proc fp = $spawn f(3);
|
|---|
| 30 |
|
|---|
| 31 | $wait(fp);
|
|---|
| 32 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.