Skip to content

Commit 17325eb

Browse files
committed
Simplify __CPROVER_{r,w,rw}_ok expansion
When simplification is enabled, goto_check should produce simplified expressions only.
1 parent 3f9ae1c commit 17325eb

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

regression/cbmc/r_w_ok9/simplify.desc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
main.c
3+
--show-goto-functions
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
false ∨
8+
∨ false
9+
--
10+
__CPROVER_{r,w,rw}_ok must be rewritten everywhere, and the resulting expression
11+
should be simplified (and, therefore, not contain "false" in a disjunction).

regression/validate-trace-xml-schema/check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
['integer-assignments1', 'integer-typecheck.desc'],
2626
['destructors', 'compound_literal.desc'],
2727
['destructors', 'enter_lexical_block.desc'],
28+
['r_w_ok9', 'simplify.desc'],
2829
['reachability-slice-interproc2', 'test.desc'],
2930
# this one wants show-properties instead producing a trace
3031
['show_properties1', 'test.desc'],

src/analyses/goto_check_c.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,10 @@ optionalt<exprt> goto_check_ct::rw_ok_check(exprt expr)
19181918
for(const auto &c : conditions)
19191919
conjuncts.push_back(c.assertion);
19201920

1921-
return conjunction(conjuncts);
1921+
exprt c = conjunction(conjuncts);
1922+
if(enable_simplify)
1923+
simplify(c, ns);
1924+
return c;
19221925
}
19231926
else if(modified)
19241927
return std::move(expr);

0 commit comments

Comments
 (0)