Skip to content

Commit bc772e4

Browse files
committed
goto_check: check expressions inside exists and forall
Original code by @kroening in `goto_check_guard` branch.
1 parent 031cd8c commit bc772e4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/analyses/goto_check_c.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Author: Daniel Kroening, [email protected]
2626
#include <util/ieee_float.h>
2727
#include <util/invariant.h>
2828
#include <util/make_unique.h>
29+
#include <util/mathematical_expr.h>
2930
#include <util/message.h>
3031
#include <util/options.h>
3132
#include <util/pointer_expr.h>
@@ -1795,11 +1796,19 @@ void goto_check_ct::check_rec_arithmetic_op(
17951796

17961797
void goto_check_ct::check_rec(const exprt &expr, const guardt &guard)
17971798
{
1798-
// we don't look into quantifiers
17991799
if(expr.id() == ID_exists || expr.id() == ID_forall)
1800-
return;
1800+
{
1801+
// the scoped variables may be used in the assertion
1802+
const auto &quantifier_expr = to_quantifier_expr(expr);
18011803

1802-
if(expr.id() == ID_address_of)
1804+
auto new_guard = [&guard, &quantifier_expr](exprt expr) {
1805+
return guard(forall_exprt(quantifier_expr.symbol(), expr));
1806+
};
1807+
1808+
check_rec(quantifier_expr.where(), new_guard);
1809+
return;
1810+
}
1811+
else if(expr.id() == ID_address_of)
18031812
{
18041813
check_rec_address(to_address_of_expr(expr).object(), guard);
18051814
return;

0 commit comments

Comments
 (0)