mirror of
https://github.com/Z3Prover/z3
synced 2025-06-07 06:33:23 +00:00
fix re-entrancy bug during flip in arith_base
This commit is contained in:
parent
e4e5735620
commit
f64d077d2a
1 changed files with 11 additions and 6 deletions
|
@ -668,14 +668,13 @@ namespace sls {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!check_update(v, new_value))
|
if (!check_update(v, new_value))
|
||||||
return false;
|
return false;
|
||||||
apply_checked_update();
|
apply_checked_update();
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
buffer<sat::bool_var> to_flip;
|
||||||
for (auto const& [coeff, bv] : vi.m_bool_vars) {
|
for (auto const& [coeff, bv] : vi.m_bool_vars) {
|
||||||
auto& ineq = *atom(bv);
|
auto& ineq = *atom(bv);
|
||||||
bool old_sign = sign(bv);
|
bool old_sign = sign(bv);
|
||||||
|
@ -684,14 +683,19 @@ namespace sls {
|
||||||
ineq.m_args_value += coeff * (new_value - old_value);
|
ineq.m_args_value += coeff * (new_value - old_value);
|
||||||
num_t dtt_new = dtt(old_sign, ineq);
|
num_t dtt_new = dtt(old_sign, ineq);
|
||||||
if (dtt_new != 0)
|
if (dtt_new != 0)
|
||||||
ctx.flip(bv);
|
to_flip.push_back(bv);
|
||||||
SASSERT(dtt(sign(bv), ineq) == 0);
|
|
||||||
}
|
}
|
||||||
IF_VERBOSE(5, verbose_stream() << "repair: v" << v << " := " << old_value << " -> " << new_value << "\n");
|
IF_VERBOSE(5, verbose_stream() << "repair: v" << v << " := " << old_value << " -> " << new_value << "\n");
|
||||||
vi.m_value = new_value;
|
vi.m_value = new_value;
|
||||||
ctx.new_value_eh(e);
|
ctx.new_value_eh(e);
|
||||||
m_last_var = v;
|
m_last_var = v;
|
||||||
|
|
||||||
|
for (auto bv : to_flip) {
|
||||||
|
ctx.flip(bv);
|
||||||
|
SASSERT(dtt(sign(bv), *atom(bv)) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
IF_VERBOSE(10, verbose_stream() << "new value eh " << mk_bounded_pp(e, m) << "\n");
|
IF_VERBOSE(10, verbose_stream() << "new value eh " << mk_bounded_pp(e, m) << "\n");
|
||||||
|
|
||||||
for (auto idx : vi.m_muls)
|
for (auto idx : vi.m_muls)
|
||||||
|
@ -2292,8 +2296,9 @@ namespace sls {
|
||||||
for (auto const& [c, v] : i.m_args)
|
for (auto const& [c, v] : i.m_args)
|
||||||
val += c * value(v);
|
val += c * value(v);
|
||||||
if (val != i.m_args_value)
|
if (val != i.m_args_value)
|
||||||
verbose_stream() << i << "\n";
|
verbose_stream() << val << ": " << i << "\n";
|
||||||
SASSERT(val == i.m_args_value);
|
SASSERT(val == i.m_args_value);
|
||||||
|
VERIFY(val == i.m_args_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue