File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
regression/cbmc-incr-smt2/pointers Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdbool.h>
2
+ #include <stddef.h>
3
+ #include <stdint.h>
4
+
5
+ int main ()
6
+ {
7
+ uint16_t x ;
8
+ uint32_t y ;
9
+ bool nondet_bool1 ;
10
+ void * ptr = nondet_bool1 ? (& x ) : (& y );
11
+ size_t size = __CPROVER_OBJECT_SIZE (ptr );
12
+ __CPROVER_assert (size == 2 || size == 4 , "Expected int sizes." );
13
+ __CPROVER_assert (size == 2 , "Size is always 2. (Can be disproved.)" );
14
+ __CPROVER_assert (size == 4 , "Size is always 4. (Can be disproved.)" );
15
+ size_t null_size = __CPROVER_OBJECT_SIZE (NULL );
16
+ __CPROVER_assert (null_size == 254 , "Size of NULL." );
17
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ object_size.c
3
+ --trace
4
+ line 12 Expected int sizes\.: SUCCESS
5
+ line 13 Size is always 2\. \(Can be disproved\.\): FAILURE
6
+ line 14 Size is always 4\. \(Can be disproved\.\): FAILURE
7
+ line 16 Size of NULL\.: FAILURE
8
+ size=2ul
9
+ size=4ul
10
+ null_size=0ul
11
+ ^EXIT=10$
12
+ ^SIGNAL=0$
13
+ --
14
+ --
15
+ Test that the model of object_size can take only the expected values in the case
16
+ where the pointer it is given may point to one of two objects. Test that the
17
+ size of the null object is zero.
You can’t perform that action at this time.
0 commit comments