3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-27 16:38:45 +00:00

fix infinite loop in internalize

This commit is contained in:
Nuno Lopes 2022-09-14 11:50:53 +01:00
parent 34969b71ee
commit 16ef89905d
2 changed files with 18 additions and 19 deletions

View file

@ -28,7 +28,7 @@ extern "C" {
RESET_ERROR_CODE(); RESET_ERROR_CODE();
std::ostringstream buffer; std::ostringstream buffer;
to_stats_ref(s).display_smt2(buffer); to_stats_ref(s).display_smt2(buffer);
std::string result = buffer.str(); std::string result = std::move(buffer).str();
// Hack for removing the trailing '\n' // Hack for removing the trailing '\n'
SASSERT(result.size() > 0); SASSERT(result.size() > 0);
result.resize(result.size()-1); result.resize(result.size()-1);

View file

@ -3207,26 +3207,25 @@ namespace smt {
reduce_assertions(); reduce_assertions();
if (get_cancel_flag()) if (get_cancel_flag())
return; return;
qhead = m_asserted_formulas.get_qhead(); if (m_asserted_formulas.inconsistent()) {
if (!m_asserted_formulas.inconsistent()) { if (!inconsistent())
unsigned sz = m_asserted_formulas.get_num_formulas(); asserted_inconsistent();
while (qhead < sz) {
if (get_cancel_flag()) {
m_asserted_formulas.commit(qhead);
return;
}
expr * f = m_asserted_formulas.get_formula(qhead);
proof * pr = m_asserted_formulas.get_formula_proof(qhead);
SASSERT(!pr || f == m.get_fact(pr));
internalize_assertion(f, pr, 0);
qhead++;
}
m_asserted_formulas.commit();
}
if (m_asserted_formulas.inconsistent() && !inconsistent()) {
asserted_inconsistent();
break; break;
} }
qhead = m_asserted_formulas.get_qhead();
unsigned sz = m_asserted_formulas.get_num_formulas();
while (qhead < sz) {
if (get_cancel_flag()) {
m_asserted_formulas.commit(qhead);
return;
}
expr * f = m_asserted_formulas.get_formula(qhead);
proof * pr = m_asserted_formulas.get_formula_proof(qhead);
SASSERT(!pr || f == m.get_fact(pr));
internalize_assertion(f, pr, 0);
++qhead;
}
m_asserted_formulas.commit();
} }
while (qhead < m_asserted_formulas.get_num_formulas()); while (qhead < m_asserted_formulas.get_num_formulas());