File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed
regression/cbmc-incr-smt2/pointer_arithmetic Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ #include <stdint.h>
2+
3+ #define NULL (void *)0
4+
5+ int main ()
6+ {
7+ int32_t * a ;
8+ __CPROVER_assume (a != NULL );
9+ int32_t * z = a + 2 * sizeof (int32_t );
10+
11+ __CPROVER_assert (a != z , "expected successful because of pointer arithmetic" );
12+ __CPROVER_assert (a == z , "expected failure because of pointer arithmetic" );
13+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ addition_compound_expr.c
3+ --trace
4+ \[main\.assertion\.1\] line \d+ expected successful because of pointer arithmetic: SUCCESS
5+ \[main\.assertion\.2\] line \d+ expected failure because of pointer arithmetic: FAILURE
6+ ^EXIT=10$
7+ ^SIGNAL=0$
8+ --
9+ --
10+ This is testing the same thing as the test in addition_simple.desc, with the
11+ difference being that the addition expression here is compound, containing a
12+ more elaborate operand in the form of a multiplication containing a sizeof
13+ operator.
Original file line number Diff line number Diff line change 1+ #define NULL (void *)0
2+
3+ int main ()
4+ {
5+ int * x ;
6+ int * y = x + 1 ;
7+ __CPROVER_assume (x != NULL );
8+ __CPROVER_assume (y != NULL );
9+
10+ __CPROVER_assert (y == x , "expected false after pointer manipulation" );
11+ __CPROVER_assert (y != x , "expected true" );
12+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ addition_simple.c
3+ --trace
4+ \[main\.assertion\.1\] line \d+ expected false after pointer manipulation: FAILURE
5+ \[main\.assertion\.2\] line \d+ expected true: SUCCESS
6+ ^EXIT=10$
7+ ^SIGNAL=0$
8+ --
9+ --
10+ This is testing basic pointer arithmetic by adding by incrementing a pointer's
11+ address and assigning that value to another pointer, then asserting that they
12+ don't point to the same thing.
You can’t perform that action at this time.
0 commit comments