mirror of
https://github.com/Z3Prover/z3
synced 2025-04-07 09:55:19 +00:00
be nicer when memout is reached in SMT internalize: return undef rather than crashing
This commit is contained in:
parent
7cc58c9cc3
commit
47324af210
|
@ -2961,7 +2961,11 @@ namespace smt {
|
||||||
pop_to_base_lvl();
|
pop_to_base_lvl();
|
||||||
setup_context(false);
|
setup_context(false);
|
||||||
bool was_consistent = !inconsistent();
|
bool was_consistent = !inconsistent();
|
||||||
internalize_assertions(); // internalize assertions before invoking m_asserted_formulas.push_scope
|
try {
|
||||||
|
internalize_assertions(); // internalize assertions before invoking m_asserted_formulas.push_scope
|
||||||
|
} catch (cancel_exception&) {
|
||||||
|
throw default_exception("Resource limits hit in push");
|
||||||
|
}
|
||||||
if (!m.inc())
|
if (!m.inc())
|
||||||
throw default_exception("push canceled");
|
throw default_exception("push canceled");
|
||||||
scoped_suspend_rlimit _suspend_cancel(m.limit());
|
scoped_suspend_rlimit _suspend_cancel(m.limit());
|
||||||
|
@ -3556,7 +3560,12 @@ namespace smt {
|
||||||
return p(asms);
|
return p(asms);
|
||||||
}
|
}
|
||||||
|
|
||||||
internalize_assertions();
|
try {
|
||||||
|
internalize_assertions();
|
||||||
|
} catch (cancel_exception&) {
|
||||||
|
VERIFY(resource_limits_exceeded());
|
||||||
|
return l_undef;
|
||||||
|
}
|
||||||
expr_ref_vector theory_assumptions(m);
|
expr_ref_vector theory_assumptions(m);
|
||||||
add_theory_assumptions(theory_assumptions);
|
add_theory_assumptions(theory_assumptions);
|
||||||
if (!theory_assumptions.empty()) {
|
if (!theory_assumptions.empty()) {
|
||||||
|
@ -3620,10 +3629,15 @@ namespace smt {
|
||||||
do {
|
do {
|
||||||
pop_to_base_lvl();
|
pop_to_base_lvl();
|
||||||
expr_ref_vector asms(m, num_assumptions, assumptions);
|
expr_ref_vector asms(m, num_assumptions, assumptions);
|
||||||
internalize_assertions();
|
try {
|
||||||
add_theory_assumptions(asms);
|
internalize_assertions();
|
||||||
TRACE("unsat_core_bug", tout << asms << "\n";);
|
add_theory_assumptions(asms);
|
||||||
init_assumptions(asms);
|
TRACE("unsat_core_bug", tout << asms << '\n';);
|
||||||
|
init_assumptions(asms);
|
||||||
|
} catch (cancel_exception&) {
|
||||||
|
VERIFY(resource_limits_exceeded());
|
||||||
|
return l_undef;
|
||||||
|
}
|
||||||
TRACE("before_search", display(tout););
|
TRACE("before_search", display(tout););
|
||||||
r = search();
|
r = search();
|
||||||
r = mk_unsat_core(r);
|
r = mk_unsat_core(r);
|
||||||
|
@ -3641,11 +3655,16 @@ namespace smt {
|
||||||
do {
|
do {
|
||||||
pop_to_base_lvl();
|
pop_to_base_lvl();
|
||||||
expr_ref_vector asms(cube);
|
expr_ref_vector asms(cube);
|
||||||
internalize_assertions();
|
try {
|
||||||
add_theory_assumptions(asms);
|
internalize_assertions();
|
||||||
// introducing proxies: if (!validate_assumptions(asms)) return l_undef;
|
add_theory_assumptions(asms);
|
||||||
for (auto const& clause : clauses) if (!validate_assumptions(clause)) return l_undef;
|
// introducing proxies: if (!validate_assumptions(asms)) return l_undef;
|
||||||
init_assumptions(asms);
|
for (auto const& clause : clauses) if (!validate_assumptions(clause)) return l_undef;
|
||||||
|
init_assumptions(asms);
|
||||||
|
} catch (cancel_exception&) {
|
||||||
|
VERIFY(resource_limits_exceeded());
|
||||||
|
return l_undef;
|
||||||
|
}
|
||||||
for (auto const& clause : clauses) init_clause(clause);
|
for (auto const& clause : clauses) init_clause(clause);
|
||||||
r = search();
|
r = search();
|
||||||
r = mk_unsat_core(r);
|
r = mk_unsat_core(r);
|
||||||
|
|
|
@ -62,6 +62,8 @@ namespace smt {
|
||||||
|
|
||||||
class model_generator;
|
class model_generator;
|
||||||
|
|
||||||
|
struct cancel_exception {};
|
||||||
|
|
||||||
class context {
|
class context {
|
||||||
friend class model_generator;
|
friend class model_generator;
|
||||||
friend class lookahead;
|
friend class lookahead;
|
||||||
|
|
|
@ -353,7 +353,7 @@ namespace smt {
|
||||||
*/
|
*/
|
||||||
void context::internalize(expr * n, bool gate_ctx) {
|
void context::internalize(expr * n, bool gate_ctx) {
|
||||||
if (memory::above_high_watermark())
|
if (memory::above_high_watermark())
|
||||||
throw default_exception("resource limit exceeded during internalization");
|
throw cancel_exception();
|
||||||
internalize_deep(n);
|
internalize_deep(n);
|
||||||
internalize_rec(n, gate_ctx);
|
internalize_rec(n, gate_ctx);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue