mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
fix bug reported on stackoverflow on crash for unconstrained variables
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
0e83a2b1af
commit
444879db5f
|
@ -87,8 +87,13 @@ namespace opt {
|
||||||
smt::theory_opt& opt_solver::get_optimizer() {
|
smt::theory_opt& opt_solver::get_optimizer() {
|
||||||
smt::context& ctx = m_context.get_context();
|
smt::context& ctx = m_context.get_context();
|
||||||
smt::theory_id arith_id = m_context.m().get_family_id("arith");
|
smt::theory_id arith_id = m_context.m().get_family_id("arith");
|
||||||
smt::theory* arith_theory = ctx.get_theory(arith_id);
|
smt::theory* arith_theory = ctx.get_theory(arith_id);
|
||||||
|
|
||||||
|
if (!arith_theory) {
|
||||||
|
ctx.register_plugin(alloc(smt::theory_mi_arith, m, m_params));
|
||||||
|
arith_theory = ctx.get_theory(arith_id);
|
||||||
|
SASSERT(arith_theory);
|
||||||
|
}
|
||||||
if (typeid(smt::theory_mi_arith) == typeid(*arith_theory)) {
|
if (typeid(smt::theory_mi_arith) == typeid(*arith_theory)) {
|
||||||
return dynamic_cast<smt::theory_mi_arith&>(*arith_theory);
|
return dynamic_cast<smt::theory_mi_arith&>(*arith_theory);
|
||||||
}
|
}
|
||||||
|
|
|
@ -870,6 +870,7 @@ namespace smt {
|
||||||
atom_kind kind2 = a2->get_atom_kind();
|
atom_kind kind2 = a2->get_atom_kind();
|
||||||
bool v_is_int = is_int(v);
|
bool v_is_int = is_int(v);
|
||||||
SASSERT(v == a2->get_var());
|
SASSERT(v == a2->get_var());
|
||||||
|
if (k1 == k2 && kind1 == kind2) return;
|
||||||
SASSERT(k1 != k2 || kind1 != kind2);
|
SASSERT(k1 != k2 || kind1 != kind2);
|
||||||
parameter coeffs[3] = { parameter(symbol("farkas")),
|
parameter coeffs[3] = { parameter(symbol("farkas")),
|
||||||
parameter(rational(1)), parameter(rational(1)) };
|
parameter(rational(1)), parameter(rational(1)) };
|
||||||
|
|
Loading…
Reference in a new issue