1- int a [10 ];
2-
3- int c [10 ] = {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 };
4-
5- void param_test (int array [])
6- {
7- array [1 ] = 5 ;
8- // TODO: This is marked as "unknown" when running analysis of param_test and global_test. Doesn't seem correct
9- // as array[1] is being assigned one line above?
10- __CPROVER_assert (array [1 ]== 5 , "array[1]==5" );
11- }
12-
131void param_test_val (int array [], int x )
142{
153 array [1 ] = x ;
16- // TODO: This is marked as "unknown" when running analysis of param_test and global_test. Doesn't seem correct
17- // as array[1] is being assigned one line above?
18- //__CPROVER_assert(array[1]==5, "array[1]==5");
19- }
20-
21- void global_test ()
22- {
23- a [2 ] = 6 ;
24- __CPROVER_assert (a [2 ]== 6 , "a[2]==6" );
25- c [8 ] = 15 ;
26- __CPROVER_assert (c [8 ]== 15 , "c[8]==15" );
27- // TODO: This is marked as "unknown" when running analysis of global_test. CORRECT?
28- __CPROVER_assert (c [9 ]== 9 , "c[9]==9" );
294}
305
316void pass_param ()
327{
338 int b [10 ] = {0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 };
34-
35- __CPROVER_assert (b [0 ]== 0 , "b[0]==0" );
36- __CPROVER_assert (b [4 ]== 4 , "b[4]==4" );
37- __CPROVER_assert (b [8 ]== 8 , "b[8]==8" );
38- // TODO: This is marked as "unknown" when running analysis of pass_param. CORRECT?
39- // The theme here is that global array initialisation assertions are marked as "unknown". Why?
40- __CPROVER_assert (c [8 ]== 8 , "c[8]==8" );
41-
42- param_test_val (b , 5 );
439
44- __CPROVER_assert ( b [ 1 ] == 5 , "b[1]==5" );
10+ param_test_val ( b , 5 );
4511
12+ // This assertion should be true since b[0] is unmodified
4613 __CPROVER_assert (b [0 ]== 0 , "b[0]==0" );
47- __CPROVER_assert (b [4 ]== 4 , "b[4]==4" );
48- __CPROVER_assert (b [8 ]== 8 , "b[8]==8" );
4914
50- __CPROVER_assert (b [1 ]== 1 , "b[1]==1" );
15+ // This assertion should be true since b[1] can only have one value
16+ __CPROVER_assert (b [1 ]== 5 , "b[1]==5" );
17+
5118 param_test_val (b , 6 );
19+
20+ // Both these assertions shoul be unknown since the domain for
21+ // param_test_val, x is TOP so we don't know what is written
5222 __CPROVER_assert (b [1 ]== 5 , "b[1]==5" );
5323 __CPROVER_assert (b [1 ]== 6 , "b[1]==6" );
24+
25+ // b[0] is still not modified so this assertion should still be true
5426 __CPROVER_assert (b [0 ]== 0 , "b[0]==0" );
55- __CPROVER_assert (b [8 ]== 8 , "b[8]==8" );
5627}
0 commit comments