3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 22:23:22 +00:00

Fixed inconsistent state upon solver interruption. Partially fixes #951.

This commit is contained in:
Christoph M. Wintersteiger 2017-07-21 17:42:48 +01:00
parent 943dc8118a
commit faa19117e4
4 changed files with 38 additions and 31 deletions

View file

@ -61,7 +61,17 @@ void cached_var_subst::operator()(quantifier * qa, unsigned num_bindings, smt::e
return; return;
} }
m_proc(qa->get_expr(), new_key->m_num_bindings, new_key->m_bindings, result); SASSERT(entry->get_data().m_value == 0);
try {
m_proc(qa->get_expr(), new_key->m_num_bindings, new_key->m_bindings, result);
}
catch (...) {
// CMW: The var_subst reducer was interrupted and m_instances is
// in an inconsistent state; we need to remove (new_key, 0).
m_instances.remove(new_key);
throw; // Throw on to smt::qi_queue/smt::solver.
}
// cache result // cache result
entry->get_data().m_value = result; entry->get_data().m_value = result;
@ -74,6 +84,3 @@ void cached_var_subst::operator()(quantifier * qa, unsigned num_bindings, smt::e
m_refs.push_back(new_key->m_bindings[i]); m_refs.push_back(new_key->m_bindings[i]);
m_refs.push_back(result); m_refs.push_back(result);
} }

View file

@ -75,7 +75,7 @@ namespace smt {
}; };
bool model_based() const; bool model_based() const;
bool mbqi_enabled(quantifier *q) const; // can mbqi instantiate this quantifier? bool mbqi_enabled(quantifier *q) const; // can mbqi instantiate this quantifier?
void adjust_model(proto_model * m); void adjust_model(proto_model * m);
check_model_result check_model(proto_model * m, obj_map<enode, app *> const & root2value); check_model_result check_model(proto_model * m, obj_map<enode, app *> const & root2value);