mirror of
https://github.com/Z3Prover/z3
synced 2025-06-12 17:06:14 +00:00
fix #6615
make rewriting exception safe (for cancelation). The state during restart in smt_context is not exception safe.
This commit is contained in:
parent
027770930e
commit
46d37b6e30
2 changed files with 30 additions and 6 deletions
|
@ -1237,7 +1237,7 @@ namespace seq {
|
||||||
seq.str.is_string(x)) {
|
seq.str.is_string(x)) {
|
||||||
expr_ref len(n, m);
|
expr_ref len(n, m);
|
||||||
m_rewrite(len);
|
m_rewrite(len);
|
||||||
SASSERT(n != len);
|
SASSERT(m.limit().is_canceled() || n != len);
|
||||||
add_clause(mk_eq(len, n));
|
add_clause(mk_eq(len, n));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -967,17 +967,41 @@ void th_rewriter::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void th_rewriter::operator()(expr_ref & term) {
|
void th_rewriter::operator()(expr_ref & term) {
|
||||||
expr_ref result(term.get_manager());
|
expr_ref result(term.get_manager());
|
||||||
m_imp->operator()(term, result);
|
try {
|
||||||
term = std::move(result);
|
m_imp->operator()(term, result);
|
||||||
|
term = std::move(result);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
if (!term.get_manager().inc())
|
||||||
|
return;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void th_rewriter::operator()(expr * t, expr_ref & result) {
|
void th_rewriter::operator()(expr * t, expr_ref & result) {
|
||||||
m_imp->operator()(t, result);
|
try {
|
||||||
|
m_imp->operator()(t, result);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
result = t;
|
||||||
|
if (!result.get_manager().inc())
|
||||||
|
return;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void th_rewriter::operator()(expr * t, expr_ref & result, proof_ref & result_pr) {
|
void th_rewriter::operator()(expr * t, expr_ref & result, proof_ref & result_pr) {
|
||||||
m_imp->operator()(t, result, result_pr);
|
try {
|
||||||
|
m_imp->operator()(t, result, result_pr);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
result = t;
|
||||||
|
result_pr = nullptr;
|
||||||
|
if (!result.get_manager().inc())
|
||||||
|
return;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
expr_ref th_rewriter::operator()(expr * n, unsigned num_bindings, expr * const * bindings) {
|
expr_ref th_rewriter::operator()(expr * n, unsigned num_bindings, expr * const * bindings) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue