File tree Expand file tree Collapse file tree 4 files changed +56
-0
lines changed
regression/cbmc-shadow-memory Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ int main ()
4
+ {
5
+ __CPROVER_field_decl_local ("uninitialized" , (char )0 );
6
+ __CPROVER_field_decl_global ("uninitialized" , (char )0 );
7
+
8
+ int i ;
9
+ char * a = & i ;
10
+
11
+ __CPROVER_set_field (a + 1 , "uninitialized" , 1 );
12
+
13
+ assert (__CPROVER_get_field (a , "uninitialized" ) == 0 );
14
+ assert (__CPROVER_get_field (& i , "uninitialized" ) == 1 );
15
+ assert (__CPROVER_get_field (a + 1 , "uninitialized" ) == 1 );
16
+ // Expecting the remaining bytes to be untouched by the setting of the field.
17
+ assert (__CPROVER_get_field (a + 2 , "uninitialized" ) == 0 );
18
+ assert (__CPROVER_get_field (a + 3 , "uninitialized" ) == 0 );
19
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
9
+ --
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ int main ()
4
+ {
5
+ __CPROVER_field_decl_local ("uninitialized" , (_Bool )0 );
6
+ __CPROVER_field_decl_global ("uninitialized" , (_Bool )0 );
7
+
8
+ int i ;
9
+ char * a = & i ;
10
+
11
+ __CPROVER_set_field (a + 1 , "uninitialized" , 1 );
12
+
13
+ assert (__CPROVER_get_field (a , "uninitialized" ) == 0 );
14
+ assert (__CPROVER_get_field (a + 1 , "uninitialized" ) == 1 );
15
+ assert (__CPROVER_get_field (& i , "uninitialized" ) == 1 );
16
+ // Expecting the remaining bytes to be untouched by the setting of the field.
17
+ assert (__CPROVER_get_field (a + 2 , "uninitialized" ) == 0 );
18
+ assert (__CPROVER_get_field (a + 3 , "uninitialized" ) == 0 );
19
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
9
+ --
You can’t perform that action at this time.
0 commit comments