Skip to content

Commit eefccd7

Browse files
authored
Merge pull request #4113 from tautschnig/fix-negation_of_not_contains_constraint
String refinement: Do not fail if the solver returns a negative string length [blocks: #2574]
2 parents ccd97d4 + 14f542e commit eefccd7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/solvers/strings/string_refinement.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,12 @@ static exprt negation_of_not_contains_constraint(
12131213

12141214
// The negated existential becomes an universal, and this is the unrolling of
12151215
// that universal quantifier.
1216+
// Ff the upper bound is smaller than the lower bound (specifically, it might
1217+
// actually be negative as it is initially unconstrained) then there is
1218+
// nothing to do (and the reserve call would fail).
1219+
if(ube < lbe)
1220+
return and_exprt(univ_bounds, get(constraint.premise));
1221+
12161222
std::vector<exprt> conjuncts;
12171223
conjuncts.reserve(numeric_cast_v<std::size_t>(ube - lbe));
12181224
for(mp_integer i = lbe; i < ube; ++i)

0 commit comments

Comments
 (0)