source: CIVL/examples/mem/mem_tests/mem_union_widening_array2d.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: 1.3 KB
Line 
1#include<mem.cvh>
2
3int a[10][10];
4
5int main() {
6 $mem m = &a[0][0 .. 3];
7
8 m = $mem_union_widening(m, &a[0][4 .. 6]);
9 /* If a set of references have diference in only one dimension, and
10 ranges in every reference can be connected, the default widening
11 operator will combine them precisely
12 */
13 $assert($mem_contains(m, &a[0][0 .. 6]));
14 $assert(!$mem_contains(m, &a[0][7]));
15 $assert(!$mem_contains(m, &a[1][0 .. 6]));
16
17 m = &a[0 .. 3][1 .. 8];
18 m = $mem_union_widening(&a[4 .. 6][1 .. 8], m);
19 m = $mem_union_widening(&a[7 .. 8][1 .. 8], m);
20 $assert($mem_contains(m, &a[0 .. 8][1 .. 8]));
21 $assert(!$mem_contains(m, &a[9][1 .. 8]));
22 $assert(!$mem_contains(m, &a[0 .. 6][0]));
23
24 /* if not all connected, the default widening operator will result
25 * in a reference that refers to the whole dimension
26 */
27 m = &a[0 .. 3][1 .. 8];
28 m = $mem_union_widening(&a[5 .. 6][1 .. 8], m);
29 $assert($mem_contains(m, &a[0 .. 6][1 .. 8]));
30 $assert($mem_contains(m, &a[0 .. 9][1 .. 8]));
31 $assert(!$mem_contains(m, &a[0 .. 3][0]));
32
33 /*If a set of references have diference in more than one dimensions,
34 the default widening operator will result in a reference that
35 refers to the whole multiple dimensional array*/
36 m = &a[0 .. 3][0 .. 3];
37 m = $mem_union_widening(&a[4 .. 6][4 .. 6], m);
38 $assert($mem_contains(m, &a));
39}
Note: See TracBrowser for help on using the repository browser.