3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-19 10:52:02 +00:00

avoid crash on box models under cancellation. Issue # SASSERT(!m_box_models.empty());

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-06-29 04:53:28 -07:00
parent 8aee7129f6
commit 0fdf01e410
2 changed files with 19 additions and 14 deletions

View file

@ -366,12 +366,16 @@ namespace opt {
}
lbool context::execute_box() {
if (m_box_index < m_objectives.size()) {
SASSERT(m_box_index < m_box_models.size());
if (m_box_index < m_box_models.size()) {
m_model = m_box_models[m_box_index];
++m_box_index;
return l_true;
}
if (m_box_index < m_objectives.size()) {
m_model = 0;
++m_box_index;
return l_undef;
}
if (m_box_index != UINT_MAX && m_box_index >= m_objectives.size()) {
m_box_index = UINT_MAX;
return l_false;
@ -384,17 +388,14 @@ namespace opt {
if (obj.m_type == O_MAXSMT) {
solver::scoped_push _sp(get_solver());
r = execute(obj, false, false);
if (r == l_true) {
m_box_models.push_back(m_model.get());
}
m_box_models.push_back(m_model.get());
}
else {
m_box_models.push_back(m_optsmt.get_model(j));
++j;
}
}
if (r == l_true && m_objectives.size() > 0) {
SASSERT(!m_box_models.empty());
if (r == l_true && m_box_models.size() > 0) {
m_model = m_box_models[0];
}
return r;
@ -498,6 +499,9 @@ namespace opt {
}
std::string context::reason_unknown() const {
if (m.canceled()) {
return Z3_CANCELED_MSG;
}
if (m_solver.get()) {
return m_solver->reason_unknown();
}