diff --git a/src/opt/opt_context.cpp b/src/opt/opt_context.cpp index ffb8754a2..55b2a33ec 100644 --- a/src/opt/opt_context.cpp +++ b/src/opt/opt_context.cpp @@ -854,7 +854,10 @@ namespace opt { bool& neg, symbol& id, expr_ref& orig_term, unsigned& index) { if (!is_app(fml)) return false; neg = false; + orig_term = nullptr; + index = 0; app* a = to_app(fml); + if (m_objective_fns.find(a->get_decl(), index) && m_objectives[index].m_type == O_MAXSMT) { for (unsigned i = 0; i < a->get_num_args(); ++i) { expr_ref arg(a->get_arg(i), m); @@ -996,13 +999,13 @@ namespace opt { void context::from_fmls(expr_ref_vector const& fmls) { TRACE("opt", tout << fmls << "\n";); m_hard_constraints.reset(); - expr_ref orig_term(m); for (expr * fml : fmls) { app_ref tr(m); + expr_ref orig_term(m); expr_ref_vector terms(m); vector weights; rational offset(0); - unsigned index; + unsigned index = 0; symbol id; bool neg; if (is_maxsat(fml, terms, weights, offset, neg, id, orig_term, index)) {