source: CIVL/examples/mem/mem_tests/mem_havoc_complex_nc.cvl

main
Last change on this file 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: 604 bytes
RevLine 
[da65ee2]1#include<mem.cvh>
2#include<stdlib.h>
3
4$input int N;
5$assume(N > 5);
6
7struct T {
8 int a[2 * N];
9 double b[2 * N][2 * N];
10 struct T * t;
11};
12
13int main() {
14 struct T t;
15
16 $havoc(&t);
17
18 struct T old_t = t;
19
20 $mem m = &t.a[0 .. N-1];
21
22 m = $mem_union(m, &t.b[0 .. N-1][N .. 2*N-1]);
23 $mem_havoc(m);
24 $assert($forall (int i : 0 .. N-1)
25 $forall (int j : N .. 2*N-1)
26 t.a[j] == old_t.a[j] &&
27 t.b[j][i] == old_t.b[j][i]
28 );
29
30 t.t = (struct T *)malloc(sizeof(struct T));
31
32 t.t->a[N] = 2;
33 m = $mem_union(m, &t.t->a[0 .. N-1]);
34 $mem_havoc(m);
35 $assert(t.t->a[N] == 2);
36 free(t.t);
37}
Note: See TracBrowser for help on using the repository browser.