Skip to content

Commit 6948699

Browse files
committed
Replace conditions in quantified statement expressions
1 parent df9adc9 commit 6948699

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

regression/cbmc/Quantifiers-statement-expression/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ int main()
44
// no side effects!
55
int j = 0;
66
int a[5] = {0 , 0, 0, 0, 0};
7-
assert(__CPROVER_forall { int i; ({ int j = i; i=i; if(i < 0 || i >4) i = 1; ( a[i] < 5); }) });
7+
assert(__CPROVER_forall { int i; ({ int j = i; int cond = i < 0 || i >4; if(cond) i = 1; ( a[i] < 5); }) });
88
// clang-format on
99

1010
return 0;

src/ansi-c/goto-conversion/goto_clean_expr.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -211,19 +211,16 @@ static exprt convert_statement_expression(
211211
// path_condition && cond.
212212
case goto_program_instruction_typet::GOTO:
213213
{
214-
if(!current_it->condition().is_true())
214+
exprt condition = current_it->condition();
215+
replace_expr(value_map, condition);
216+
if(!condition.is_true())
215217
{
216218
auto next_it = current_it->targets.front();
217219
exprt copy_path_condition = path_condition;
218-
replace_mapt copy_symbol_map = value_map;
219-
auto copy_condition = current_it->condition();
220-
path_condition =
221-
and_exprt(path_condition, not_exprt(current_it->condition()));
220+
path_condition = and_exprt(path_condition, not_exprt(condition));
222221
current_it++;
223222
paths.push_back(
224-
next_it,
225-
and_exprt(copy_path_condition, copy_condition),
226-
copy_symbol_map);
223+
next_it, and_exprt(copy_path_condition, condition), value_map);
227224
}
228225
else
229226
{

0 commit comments

Comments
 (0)