Skip to content

Commit e25e568

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

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>
@@ -1789,11 +1790,19 @@ void goto_check_ct::check_rec_arithmetic_op(const exprt &expr, const guardt &gua
17891790

17901791
void goto_check_ct::check_rec(const exprt &expr, const guardt &guard)
17911792
{
1792-
// we don't look into quantifiers
17931793
if(expr.id() == ID_exists || expr.id() == ID_forall)
1794+
{
1795+
// the scoped variables may be used in the assertion
1796+
const auto &quantifier_expr = to_quantifier_expr(expr);
1797+
1798+
auto new_guard = [&guard, &quantifier_expr](exprt expr) {
1799+
return guard(forall_exprt(quantifier_expr.symbol(), expr));
1800+
};
1801+
1802+
check_rec(quantifier_expr.where(), new_guard);
17941803
return;
1795-
1796-
if(expr.id() == ID_address_of)
1804+
}
1805+
else if(expr.id() == ID_address_of)
17971806
{
17981807
check_rec_address(to_address_of_expr(expr).object(), guard);
17991808
return;

0 commit comments

Comments
 (0)