File tree 24 files changed +296
-0
lines changed
regression/cbmc-primitives
24 files changed +296
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <stdlib.h>
3
+
4
+ void main ()
5
+ {
6
+ char * p = malloc (1 );
7
+ free (p );
8
+
9
+ assert (__CPROVER_DYNAMIC_OBJECT (p ));
10
+ assert (!__CPROVER_DYNAMIC_OBJECT (p ));
11
+ }
Original file line number Diff line number Diff line change
1
+ FUTURE
2
+ main.c
3
+ --no-simplify --no-propagation
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line \d+ assertion __CPROVER_DYNAMIC_OBJECT\(p\): FAILURE
7
+ \[main.assertion.2\] line \d+ assertion !__CPROVER_DYNAMIC_OBJECT\(p\): FAILURE
8
+ --
9
+ ^warning: ignoring
10
+ --
11
+ Check that the dynamic object property is havoc'd when dynamic objects are
12
+ deallocated. We use --no-simplify and --no-propagation to ensure that the case
13
+ is not solved by the constant propagation and thus tests the constraint
14
+ encoding. Recorded as ADA-526.
Original file line number Diff line number Diff line change
1
+ FUTURE
2
+ main.c
3
+
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line \d+ assertion __CPROVER_DYNAMIC_OBJECT\(p\): FAILURE
7
+ \[main.assertion.2\] line \d+ assertion !__CPROVER_DYNAMIC_OBJECT\(p\): FAILURE
8
+ --
9
+ ^warning: ignoring
10
+ --
11
+ Check that the dynamic object property is havoc'd when dynamic objects are
12
+ deallocated. Recorded as ADA-526.
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <stdlib.h>
3
+
4
+ void main ()
5
+ {
6
+ char * p ;
7
+
8
+ assert (__CPROVER_DYNAMIC_OBJECT (p ));
9
+ assert (!__CPROVER_DYNAMIC_OBJECT (p ));
10
+ }
Original file line number Diff line number Diff line change
1
+ FUTURE
2
+ main.c
3
+ --no-simplify --no-propagation
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line \d+ assertion __CPROVER_DYNAMIC_OBJECT\(p\): FAILURE
7
+ \[main.assertion.2\] line \d+ assertion !__CPROVER_DYNAMIC_OBJECT\(p\): FAILURE
8
+ --
9
+ ^warning: ignoring
10
+ --
11
+ Check that the dynamic object property is nondet for uninitialized pointers. We
12
+ use --no-simplify and --no-propagation to ensure that the case is not solved by
13
+ the constant propagation and thus tests the constraint encoding. Recorded as
14
+ ADA-526.
Original file line number Diff line number Diff line change
1
+ FUTURE
2
+ main.c
3
+
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line \d+ assertion __CPROVER_DYNAMIC_OBJECT\(p\): FAILURE
7
+ \[main.assertion.2\] line \d+ assertion !__CPROVER_DYNAMIC_OBJECT\(p\): FAILURE
8
+ --
9
+ ^warning: ignoring
10
+ --
11
+ Check that the dynamic object property is nondet for uninitialized pointers.
12
+ Recorded as ADA-526.
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <stdlib.h>
3
+
4
+ void main ()
5
+ {
6
+ char * p = malloc (1 );
7
+ free (p );
8
+
9
+ assert (__CPROVER_OBJECT_SIZE (p ) == 1 );
10
+ assert (__CPROVER_OBJECT_SIZE (p ) != 1 );
11
+
12
+ {
13
+ char c ;
14
+ p = & c ;
15
+ }
16
+
17
+ assert (__CPROVER_OBJECT_SIZE (p ) == 1 );
18
+ assert (__CPROVER_OBJECT_SIZE (p ) != 1 );
19
+ }
Original file line number Diff line number Diff line change
1
+ FUTURE
2
+ main.c
3
+
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line \d+ assertion __CPROVER_OBJECT_SIZE\(p\) == 1: FAILURE
7
+ \[main.assertion.2\] line \d+ assertion __CPROVER_OBJECT_SIZE\(p\) != 1: FAILURE
8
+ \[main.assertion.3\] line \d+ assertion __CPROVER_OBJECT_SIZE\(p\) == 1: FAILURE
9
+ \[main.assertion.4\] line \d+ assertion __CPROVER_OBJECT_SIZE\(p\) != 1: FAILURE
10
+ --
11
+ ^warning: ignoring
12
+ --
13
+ Check that object size is havoc'd when objects are deallocated. We use
14
+ --no-simplify and --no-propagation to ensure that the case is not solved by the
15
+ constant propagation and thus tests the constraint encoding. Recorded as
16
+ ADA-527.
Original file line number Diff line number Diff line change
1
+ FUTURE
2
+ main.c
3
+
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line \d+ assertion __CPROVER_OBJECT_SIZE\(p\) == 1: FAILURE
7
+ \[main.assertion.2\] line \d+ assertion __CPROVER_OBJECT_SIZE\(p\) != 1: FAILURE
8
+ \[main.assertion.3\] line \d+ assertion __CPROVER_OBJECT_SIZE\(p\) == 1: FAILURE
9
+ \[main.assertion.4\] line \d+ assertion __CPROVER_OBJECT_SIZE\(p\) != 1: FAILURE
10
+ --
11
+ ^warning: ignoring
12
+ --
13
+ Check that object size is havoc'd when objects are deallocated. Recorded as
14
+ ADA-527.
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ void main ()
4
+ {
5
+ char * p ;
6
+ assert (__CPROVER_POINTER_OFFSET (p ) >= 0 );
7
+ assert (__CPROVER_POINTER_OFFSET (p ) < 0 );
8
+ }
Original file line number Diff line number Diff line change
1
+ FUTURE
2
+ main.c
3
+ --no-simplify --no-propagation
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line \d+ assertion __CPROVER_POINTER_OFFSET\(p\) >= 0: FAILURE
7
+ \[main.assertion.2\] line \d+ assertion __CPROVER_POINTER_OFFSET\(p\) < 0: FAILURE
8
+ --
9
+ ^warning: ignoring
10
+ --
11
+ Check that both positive and negative offsets can be chosen for uninitialized
12
+ pointers. We use --no-simplify and --no-propagation to ensure that the case is
13
+ not solved by the constant propagation and thus tests the constraint encoding.
14
+ Recorded as ADA-528.
Original file line number Diff line number Diff line change
1
+ FUTURE
2
+ main.c
3
+
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line \d+ assertion __CPROVER_POINTER_OFFSET\(p\) >= 0: FAILURE
7
+ \[main.assertion.2\] line \d+ assertion __CPROVER_POINTER_OFFSET\(p\) < 0: FAILURE
8
+ --
9
+ ^warning: ignoring
10
+ --
11
+ Check that both positive and negative offsets can be chosen for uninitialized
12
+ pointers. Recorded as ADA-528.
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <stdlib.h>
3
+
4
+ void main ()
5
+ {
6
+ char * p = malloc (1 );
7
+ assert (__CPROVER_POINTER_OBJECT (p ) == 2 );
8
+
9
+ assert (
10
+ __CPROVER_same_object (p , (char * )((size_t )2 << (sizeof (char * ) * 8 - 8 ))));
11
+ assert (
12
+ !__CPROVER_same_object (p , (char * )((size_t )3 << (sizeof (char * ) * 8 - 8 ))));
13
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --no-simplify --no-propagation
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
9
+ --
10
+ Check that __CPROVER_same_object() is true when given a pointer variable, and an
11
+ integer address pointing to the same object. We use --no-simplify and
12
+ --no-propagation to ensure that the case is not solved by the constant
13
+ propagation and thus tests the constraint encoding.
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
+ --
10
+ Check that __CPROVER_same_object() is true when given a pointer variable, and an
11
+ integer address pointing to the same object
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <stdlib.h>
3
+
4
+ void main ()
5
+ {
6
+ char * p1 = malloc (1 );
7
+ char * p2 = malloc (1 );
8
+
9
+ assert (!__CPROVER_same_object (p1 , p2 ));
10
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --no-simplify --no-propagation
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
9
+ --
10
+ Check that __CPROVER_same_object() is false when given two pointers to different
11
+ malloc'd objects. We use --no-simplify and --no-propagation to ensure that the
12
+ case is not solved by the constant propagation and thus tests the constraint
13
+ encoding.
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
+ --
10
+ Check that __CPROVER_same_object() is false when given two pointers to different
11
+ malloc'd objects
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <stdlib.h>
3
+
4
+ void main ()
5
+ {
6
+ char * p1 = malloc (1 );
7
+ free (p1 );
8
+ char * p2 = malloc (1 );
9
+
10
+ assert (!__CPROVER_same_object (p1 , p2 ));
11
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --no-simplify --no-propagation
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
9
+ --
10
+ Check that __CPROVER_same_object() is false when given two pointers, with one
11
+ of them being freed before the other is allocated. We use --no-simplify and
12
+ --no-propagation to ensure that the case is not solved by the constant
13
+ propagation and thus tests the constraint encoding.
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
+ --
10
+ Check that __CPROVER_same_object() is false when given two pointers, with one
11
+ of them being freed before the other is allocated
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <stdlib.h>
3
+
4
+ void main ()
5
+ {
6
+ char * p = malloc (10 );
7
+ char * q = p + 5 ;
8
+
9
+ assert (__CPROVER_same_object (p , q ));
10
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ --no-simplify --no-propagation
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ ^VERIFICATION SUCCESSFUL$
7
+ --
8
+ ^warning: ignoring
9
+ --
10
+ Check that __CPROVER_same_object() is true when given a pointer to the start of
11
+ a memory block, and a pointer to within the memory block. We use --no-simplify
12
+ and --no-propagation to ensure that the case is not solved by the constant
13
+ propagation and thus tests the constraint encoding.
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
+ --
10
+ Check that __CPROVER_same_object() is true when given a pointer to the start of
11
+ a memory block, and a pointer to within the memory block.
You can’t perform that action at this time.
0 commit comments