Skip to content

Commit 0ce746a

Browse files
committed
Goto-symex: record value-at-declaration in the back-end
Declarations are printed as part of a symex trace, and come with both a symbol being declared as well as an (unconstrained) initial value for that symbol. The decision procedure must learn about the initial value to include it in the model. Else, the trace value would just be question marks. Fixes: #6845
1 parent bd45729 commit 0ce746a

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
CORE
1+
CORE broken-smt-backend
22
main.c
33

44
^EXIT=10$
55
^SIGNAL=0$
66
^VERIFICATION FAILED$
77
--
88
^warning: ignoring
9+
--
10+
This test involves empty structs, which the SMT2 back-end does not currently
11+
support.

regression/cbmc/trace-values/trace-values.c

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ int main()
1616
int *q=&my_nested[1].f;
1717
int *null=0;
1818
int *junk;
19+
struct S s;
1920

2021
global_var=1;
2122
static_var=2;
@@ -34,6 +35,9 @@ int main()
3435
// assign entire struct
3536
my_nested[1]=my_nested[0];
3637

38+
// struct member
39+
s.f = 42;
40+
3741
// get a trace
3842
__CPROVER_assert(0, "");
3943
}

regression/cbmc/trace-values/trace-values.desc

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ trace-values.c
33
--trace
44
^EXIT=10$
55
^SIGNAL=0$
6+
^ s=\{ \.f=-?\d+, \.array=\{ -?\d+, -?\d+, -?\d+ \} \} \(\{ [01 ]+, \{ [01 ]+, [01 ]+, [01 ]+ \} \}\)$
67
^ global_var=1 .*$
78
^ static_var=2 .*$
89
^ local_var=3 .*$
@@ -12,6 +13,7 @@ trace-values.c
1213
^ dynamic_object1\[1.*\]=8 .*$
1314
^ my_nested\[1.*\](=\{ )?.f=0[ ,]
1415
^ my_nested\[1.*\](=\{ .f=0, )?.array=\{ 0, 4, 0 \}
16+
^ s\.f=42 \([0 ]+ 00101010\)$
1517
^VERIFICATION FAILED$
1618
--
1719
^warning: ignoring

src/goto-symex/symex_target_equation.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,8 @@ void symex_target_equationt::convert_decls(
389389
// The result is not used, these have no impact on
390390
// the satisfiability of the formula.
391391
decision_procedure.handle(step.cond_expr);
392+
decision_procedure.handle(
393+
equal_exprt{step.ssa_full_lhs, step.ssa_full_lhs});
392394
step.converted = true;
393395
with_solver_hardness(
394396
decision_procedure, hardness_register_ssa(step_index, step));

0 commit comments

Comments
 (0)