File tree Expand file tree Collapse file tree 4 files changed +57
-0
lines changed
regression/cbmc/issue_5952_soundness_bug_smt_encoding Expand file tree Collapse file tree 4 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+ #include <stdbool.h>
3+ #include <stdlib.h>
4+
5+ bool validate (const char * data , unsigned allocated )
6+ {
7+ // clang-format off
8+ bool check_1 = (data == NULL == > allocated == 0 );
9+ bool check_2 = (allocated != 0 == > __CPROVER_r_ok (data , allocated ));
10+ // clang-format on
11+ return check_1 && check_2 ;
12+ }
13+
14+ void main ()
15+ {
16+ char * data ;
17+ unsigned allocated ;
18+
19+ data = (allocated == 0 ) ? NULL : malloc (allocated );
20+
21+ __CPROVER_assume (validate (data , allocated ));
22+
23+ assert (validate (data , allocated ));
24+ }
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 * data ;
7+ data = nondet () ? malloc (1 ) : malloc (2 );
8+ assert (__CPROVER_OBJECT_SIZE (data ) <= 2 );
9+ }
Original file line number Diff line number Diff line change 1+ KNOWNBUG broken-smt-backend
2+ original_repro.c
3+ --smt2
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ \[main.assertion.\d\] line \d+ assertion validate\(data, allocated\): SUCCESS
8+ --
9+ \[main.assertion.\d\] line \d+ assertion validate\(data, allocated\): FAILURE
10+ --
11+ This is the original code that demonstrates the issue described in
12+ https://github.com/diffblue/cbmc/issues/5952
Original file line number Diff line number Diff line change 1+ CORE
2+ short.c
3+ --smt2
4+ ^EXIT=0$
5+ ^SIGNAL=0$
6+ ^VERIFICATION SUCCESSFUL$
7+ \[main.assertion.\d\] line \d assertion __CPROVER_OBJECT_SIZE\(data\) <= 2: SUCCESS
8+ --
9+ \[main.assertion.\d\] line \d assertion __CPROVER_OBJECT_SIZE\(data\) <= 2: FAILURE
10+ --
11+ This is the reduced version of the issue described in
12+ https://github.com/diffblue/cbmc/issues/5952
You can’t perform that action at this time.
0 commit comments