source: CIVL/examples/mem/mem_tests/mem_havoc_complex.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: 569 bytes
Line 
1#include<mem.cvh>
2#include<stdlib.h>
3
4struct T {
5 int a[10];
6 double b[10][10];
7 struct T * t;
8};
9
10int main() {
11 struct T t;
12
13 for (int i = 0; i < 10; i++) {
14 t.a[i] = i;
15 for (int j = 0; j < 10; j++) {
16 t.b[i][j] = i*10 + j;
17 }
18 }
19
20 $mem m = &t.a[0 .. 5];
21
22 m = $mem_union(m, &t.b[0..5][0..5]);
23 $mem_havoc(m);
24 $assert(t.a[6] == 6);
25 $assert(t.b[6][0] == 60);
26 t.t = (struct T *)malloc(sizeof(struct T));
27
28 t.t->a[0] = 0;
29 t.t->a[6] = 6;
30 m = $mem_union(m, &t.t->a[0..5]);
31 $mem_havoc(m);
32 $assert(t.t->a[6] == 6);
33 free(t.t);
34}
Note: See TracBrowser for help on using the repository browser.