source: CIVL/examples/languageFeatures/forall2.cvl@ bb03188

main test-branch
Last change on this file since bb03188 was d24f3f3, checked in by Stephen Siegel <siegel@…>, 9 months ago

Committing 3 forall examples which illustrate bugs in translation
of forall. Need to add JUnit tests for them too.

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

  • Property mode set to 100644
File size: 280 bytes
Line 
1#include <stdlib.h>
2
3typedef struct M {
4 int f;
5} *B;
6
7int main() {
8 int n = 2;
9 B x[2];
10 for (int i = 0; i < n; i++) {
11 x[i] = (B)malloc(sizeof(struct M));
12 x[i]->f = 4;
13 }
14 $assert($forall(int i : 0 .. n - 1) x[i]->f == 4);
15 $for(int i: 0 .. n-1)
16 free(x[i]);
17}
Note: See TracBrowser for help on using the repository browser.