3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-03 04:41:21 +00:00

fix underflow bug when subtracting unsigned numbers

This commit is contained in:
Nikolaj Bjorner 2021-01-21 21:01:02 -08:00
parent 987efced76
commit 64ba44d2ac
2 changed files with 12 additions and 40 deletions

View file

@ -663,7 +663,7 @@ bool theory_seq::branch_binary_variable(eq const& e) {
if (lenX + rational(xs.size()) != lenY + rational(ys.size())) {
// |x| - |y| = |ys| - |xs|
expr_ref a(mk_sub(mk_len(x), mk_len(y)), m);
expr_ref b(m_autil.mk_int(ys.size()-xs.size()), m);
expr_ref b(m_autil.mk_int(rational(ys.size())-rational(xs.size())), m);
propagate_lit(e.dep(), 0, nullptr, mk_eq(a, b, false));
return true;
}
@ -792,7 +792,7 @@ bool theory_seq::can_align_from_lhs(expr_ref_vector const& ls, expr_ref_vector c
// ls = x ++ rs ++ y, diff = |x|
else {
unsigned diff = (i + 1) - rs.size();
for (unsigned j = 0; same && j < rs.size()-1; ++j) {
for (unsigned j = 0; same && j + 1 < rs.size(); ++j) {
same = !m.are_distinct(ls[diff + j], rs[j]);
}
if (same) {