Skip to content

Commit 16e4cf1

Browse files
authored
Merge pull request #7954 from tautschnig/bugfixes/7953-interval-simp
Simplification towards singleton intervals requires single variable
2 parents e798cbb + 439bb2c commit 16e4cf1

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include <assert.h>
2+
extern void __VERIFIER_assume(int cond);
3+
extern int __VERIFIER_nondet_int(void);
4+
int main()
5+
{
6+
int z = __VERIFIER_nondet_int();
7+
int k = __VERIFIER_nondet_int();
8+
__VERIFIER_assume(1 < z);
9+
__VERIFIER_assume(1 <= z && k <= 1);
10+
assert(0);
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE new-smt-backend
2+
main.c
3+
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
9+
--
10+
Simplification must not spuriously turn the second assumption into an equality.

src/util/simplify_expr_boolean.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ simplify_exprt::resultt<> simplify_exprt::simplify_boolean(const exprt &expr)
151151
{
152152
mp_integer lower;
153153
mp_integer higher;
154+
exprt non_const_value;
154155
};
155156
boundst bounds;
156157

@@ -177,6 +178,7 @@ simplify_exprt::resultt<> simplify_exprt::simplify_boolean(const exprt &expr)
177178
auto int_opt =
178179
numeric_cast<mp_integer>(to_constant_expr(ge_expr->rhs())))
179180
{
181+
bounds.non_const_value = ge_expr->lhs();
180182
bounds.lower = *int_opt;
181183
return true;
182184
}
@@ -199,6 +201,8 @@ simplify_exprt::resultt<> simplify_exprt::simplify_boolean(const exprt &expr)
199201
// (e.g. i >= j)
200202
if(!ge_expr->rhs().is_constant())
201203
return false;
204+
if(ge_expr->lhs() != bounds.non_const_value)
205+
return false;
202206
if(
203207
auto int_opt =
204208
numeric_cast<mp_integer>(to_constant_expr(ge_expr->rhs())))

0 commit comments

Comments
 (0)