Skip to content

Commit d2ca288

Browse files
thk123tautschnig
thk123
authored andcommitted
Move invariant out of if
The full_lhs_value should have a non-nil value regardless of whether the identifier exists in the namespace. This makes visible that the SMT solver returns for an unbounded array as value ((|__CPROVER_threads_exited#1| |__CPROVER_threads_exited#1|)) which is self-referential and thus not usable.
1 parent 18da0b1 commit d2ca288

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

regression/cbmc/enum-trace1/test_json.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
CORE broken-smt-backend
22
main.c
33
--json-ui --function test --trace
44
activate-multi-line-match

regression/cbmc/json1/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
CORE broken-smt-backend
22
main.c
33
--json-ui --stop-on-fail
44
activate-multi-line-match

regression/cbmc/trace_options_json_extended/extended.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
CORE broken-smt-backend
22
test.c
33
--trace --json-ui --trace-json-extended
44
^EXIT=10$

regression/cbmc/trace_options_json_extended/non-extended.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE
1+
CORE broken-smt-backend
22
test.c
33
--trace --json-ui
44
^EXIT=10$

src/goto-programs/json_goto_trace.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ void convert_decl(
118118
const symbolt *symbol;
119119
irep_idt base_name, display_name;
120120

121+
DATA_INVARIANT(
122+
step.full_lhs_value.is_not_nil(),
123+
"full_lhs_value in assignment must not be nil");
124+
121125
if(!ns.lookup(identifier, symbol))
122126
{
123127
base_name = symbol->base_name;
@@ -132,9 +136,6 @@ void convert_decl(
132136
}
133137
else
134138
{
135-
DATA_INVARIANT(
136-
step.full_lhs_value.is_not_nil(),
137-
"full_lhs_value in assignment must not be nil");
138139
full_lhs_value = json(step.full_lhs_value, ns, ID_unknown);
139140
}
140141

0 commit comments

Comments
 (0)