File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
regression/cbmc-incr-smt2/bitvector-arithmetic-operators Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ int main ()
2+ {
3+ unsigned int a ;
4+ unsigned int b = 12 ;
5+ __CPROVER_assume (a > 15 );
6+
7+ // expected to fail by assigning a = 4294967284u in the trace
8+ // and wrapping around to 0, which results in 0 > 27.
9+ __CPROVER_assert (a + b > 27 , "a plus b should be more than 27" );
10+ // expected to fail by assigning a = 2147483648u in the trace
11+ // and evaluating to 2147483660 > 27, which is true.
12+ __CPROVER_assert (!(a + b > 27 ), "a plus b should be more than 27" );
13+
14+ // Same round of tests but for unsigned long long.
15+ unsigned long long int c ;
16+ unsigned long long int d = 12llu ;
17+ __CPROVER_assume (c > 15llu );
18+
19+ __CPROVER_assert (c + d > 27 , "c plus d should be more than 27" );
20+ __CPROVER_assert (!(c + d > 27 ), "c plus d should be more than 27" );
21+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ unsigned_behaviour.c
3+ --incremental-smt2-solver 'z3 --smt2 -in' --trace
4+ \[main\.assertion\.1\] line \d+ a plus b should be more than 27: FAILURE
5+ \[main\.assertion\.2\] line \d+ a plus b should be more than 27: FAILURE
6+ \[main\.assertion\.3\] line \d+ c plus d should be more than 27: FAILURE
7+ \[main\.assertion\.4\] line \d+ c plus d should be more than 27: FAILURE
8+ a=\d+(u|ul)?
9+ c=\d+(u|ul)?
10+ ^VERIFICATION FAILED$
11+ ^EXIT=10$
12+ ^SIGNAL=0$
13+ --
14+ --
15+ This test checks for the correct behaviour of unsigned integers around
16+ boundary values.
You can’t perform that action at this time.
0 commit comments