Skip to content

Commit 74a83f7

Browse files
committed
Add test of an example with control flow
In order to check that guards are converted ok.
1 parent b6bfe48 commit 74a83f7

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
int main()
3+
{
4+
int x, y;
5+
if(x != 0)
6+
{
7+
y = 9;
8+
}
9+
else
10+
{
11+
y = 4;
12+
}
13+
int z = y;
14+
__CPROVER_assert(x != z, "Assert of integer equality.");
15+
return 0;
16+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
CORE
2+
control_flow.c
3+
--incremental-smt2-solver "z3 --smt2 -in" --verbosity 10
4+
Passing problem to incremental SMT2 solving via "z3 --smt2 -in"
5+
Sending command to SMT2 solver - \(set-option :produce-models true\)
6+
Sending command to SMT2 solver - \(set-logic QF_UFBV\)
7+
Sending command to SMT2 solver - \(declare-fun |goto_symex::&92;guard#1| \(\) Bool\)
8+
Sending command to SMT2 solver - \(define-fun |B1| \(\) Bool |goto_symex::&92;guard#1|\)
9+
Sending command to SMT2 solver - \(declare-fun |main::1::x!0@1#1| \(\) \(_ BitVec 32\)\)
10+
Sending command to SMT2 solver - \(assert \(|=| |goto_symex::&92;guard#1| \(|not| \(|=| |main::1::x!0@1#1| \(_ bv0 32\)\)\)\)\)
11+
Sending command to SMT2 solver - \(declare-fun |main::1::y!0@1#4| \(\) \(_ BitVec 32\)\)
12+
Sending command to SMT2 solver - \(assert \(|=| |main::1::y!0@1#4| \(|ite| |goto_symex::&92;guard#1| \(_ bv9 32\) \(_ bv4 32\)\)\)\)
13+
Sending command to SMT2 solver - \(declare-fun |main::1::x!0@1#3| \(\) \(_ BitVec 32\)\)
14+
Sending command to SMT2 solver - \(assert \(|=| |main::1::x!0@1#3| \(|ite| |goto_symex::&92;guard#1| |main::1::x!0@1#1| \(_ bv0 32\)\)\)\)
15+
Sending command to SMT2 solver - \(declare-fun |main::1::z!0@1#2| \(\) \(_ BitVec 32\)\)
16+
Sending command to SMT2 solver - \(assert \(|=| |main::1::z!0@1#2| |main::1::y!0@1#4|\)\)
17+
Sending command to SMT2 solver - \(define-fun |B3| \(\) Bool \(|=| |main::1::x!0@1#1| \(_ bv0 32\)\)\)
18+
Sending command to SMT2 solver - \(assert \(|not| \(|not| \(|=| |main::1::x!0@1#3| |main::1::z!0@1#2|\)\)\)\)
19+
Sending command to SMT2 solver - \(define-fun |B4| \(\) Bool \(|not| false\)\)
20+
Sending command to SMT2 solver - \(assert |B4|\)
21+
Sending command to SMT2 solver - \(check-sat\)
22+
Solver response - sat
23+
^EXIT=(0|127|134|137)$
24+
^SIGNAL=0$
25+
--
26+
type: pointer
27+
--
28+
Test that running cbmc with the `--incremental-smt2-solver` argument can be used
29+
to send a valid SMT2 formula to a sub-process solver for an example input file
30+
which include control flow constructs. Note that at the time of adding this
31+
test, an invariant violation is expected due to the unimplemented response
32+
parsing.

0 commit comments

Comments
 (0)