File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
regression/cbmc/havoc_choice Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+ #include <stdbool.h>
3
+
4
+ bool nondet_bool ();
5
+
6
+ int main ()
7
+ {
8
+ char a = 'a' ;
9
+ char b = 'b' ;
10
+ char c = 'c' ;
11
+ char d = 'd' ;
12
+
13
+ char * p =
14
+ nondet_bool () ? (nondet_bool () ? & a : & b ) : (nondet_bool () ? & c : & d );
15
+
16
+ __CPROVER_havoc_object (p );
17
+
18
+ if (p == & a )
19
+ assert (a == 'a' );
20
+ else
21
+ assert (a == 'a' );
22
+
23
+ if (p == & b )
24
+ assert (b == 'b' );
25
+ else
26
+ assert (b == 'b' );
27
+
28
+ if (p == & c )
29
+ assert (c == 'c' );
30
+ else
31
+ assert (c == 'c' );
32
+
33
+ if (p == & d )
34
+ assert (d == 'd' );
35
+ else
36
+ assert (d == 'd' );
37
+ }
Original file line number Diff line number Diff line change
1
+ CORE new-smt-backend
2
+ main.c
3
+
4
+ \[main\.assertion\.1\] line \d+ assertion a \=\= \'a\'\: FAILURE
5
+ \[main\.assertion\.2\] line \d+ assertion a \=\= \'a\'\: SUCCESS
6
+ \[main\.assertion\.3\] line \d+ assertion b \=\= \'b\'\: FAILURE
7
+ \[main\.assertion\.4\] line \d+ assertion b \=\= \'b\'\: SUCCESS
8
+ \[main\.assertion\.5\] line \d+ assertion c \=\= \'c\'\: FAILURE
9
+ \[main\.assertion\.6\] line \d+ assertion c \=\= \'c\'\: SUCCESS
10
+ \[main\.assertion\.7\] line \d+ assertion d \=\= \'d\'\: FAILURE
11
+ \[main\.assertion\.8\] line \d+ assertion d \=\= \'d\'\: SUCCESS
12
+ ^EXIT=10$
13
+ ^SIGNAL=0$
14
+ ^VERIFICATION FAILED$
15
+ --
16
+ In the case where __CPROVER_havoc_object is applied to a pointer which points
17
+ to one of a selection of objects, only the one object which it pointed to should
18
+ be reassigned. This test is to cover the specific case where the value of the
19
+ pointer is expressed using nested ternary conditional expressions.
You can’t perform that action at this time.
0 commit comments