Skip to content

Commit d0b0dad

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

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/analyses/goto_check_c.cpp

Lines changed: 11 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>
@@ -1792,11 +1793,18 @@ void goto_check_ct::check_rec_arithmetic_op(
17921793

17931794
void goto_check_ct::check_rec(const exprt &expr, const guardt &guard)
17941795
{
1795-
// we don't look into quantifiers
17961796
if(expr.id() == ID_exists || expr.id() == ID_forall)
1797-
return;
1797+
{
1798+
// the scoped variables may be used in the assertion
1799+
const auto &quantifier_expr = to_quantifier_expr(expr);
17981800

1799-
if(expr.id() == ID_address_of)
1801+
auto new_guard = [&guard, &quantifier_expr](exprt expr)
1802+
{ return guard(forall_exprt(quantifier_expr.symbol(), expr)); };
1803+
1804+
check_rec(quantifier_expr.where(), new_guard);
1805+
return;
1806+
}
1807+
else if(expr.id() == ID_address_of)
18001808
{
18011809
check_rec_address(to_address_of_expr(expr).object(), guard);
18021810
return;

0 commit comments

Comments
 (0)