Skip to content

Commit

Permalink
set uninitialized fields. Maybe related to #1468
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <[email protected]>
  • Loading branch information
NikolajBjorner committed Feb 4, 2018
1 parent 54ba251 commit 20d6543
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
4 changes: 4 additions & 0 deletions src/interp/iz3interp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,11 @@ class iz3interp : public iz3base {
throw interpolation_failure(msg);
}
catch (const iz3translation::unsupported &) {
TRACE("iz3", tout << "unsupported\n";);
throw interpolation_error();
}
catch (const iz3proof::proof_error &) {
TRACE("iz3", tout << "proof error\n";);
throw interpolation_error();
}
profiling::timer_stop("Proof translation");
Expand Down Expand Up @@ -304,9 +306,11 @@ class iz3interp : public iz3base {
throw interpolation_failure(msg);
}
catch (const iz3translation::unsupported &) {
TRACE("iz3", tout << "unsupported\n";);
throw interpolation_error();
}
catch (const iz3proof::proof_error &) {
TRACE("iz3", tout << "proof error\n";);
throw interpolation_error();
}
profiling::timer_stop("Proof translation");
Expand Down
33 changes: 17 additions & 16 deletions src/interp/iz3translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ class iz3translation_full : public iz3translation {
ast get_bounded_variable(const ast &ineq, bool &lb){
ast nineq = normalize_inequality(ineq);
ast lhs = arg(nineq,0);
lhs.raw();
switch(op(lhs)){
case Uninterpreted:
lb = false;
Expand All @@ -993,10 +994,10 @@ class iz3translation_full : public iz3translation {
else if(arg(lhs,0) == make_int(rational(-1)))
lb = true;
else
throw unsupported();
throw unsupported(lhs);
return arg(lhs,1);
default:
throw unsupported();
throw unsupported(lhs);
}
}

Expand Down Expand Up @@ -1101,10 +1102,10 @@ class iz3translation_full : public iz3translation {
rational xcoeff = get_first_coefficient(arg(x,0),xvar);
rational ycoeff = get_first_coefficient(arg(y,0),yvar);
if(xcoeff == rational(0) || ycoeff == rational(0) || xvar != yvar)
throw unsupported(); // can be caused by non-linear arithmetic
throw unsupported(x); // can be caused by non-linear arithmetic
rational ratio = xcoeff/ycoeff;
if(denominator(ratio) != rational(1))
throw unsupported(); // can this ever happen?
throw unsupported(y); // can this ever happen?
return make_int(ratio); // better be integer!
}

Expand All @@ -1113,7 +1114,7 @@ class iz3translation_full : public iz3translation {
get_assign_bounds_coeffs(proof,farkas_coeffs);
int nargs = num_args(con);
if(nargs != (int)(farkas_coeffs.size()))
throw unsupported(); // should never happen
throw unsupported(proof); // should never happen
#if 0
if(farkas_coeffs[0] != make_int(rational(1)))
farkas_coeffs[0] = make_int(rational(1));
Expand Down Expand Up @@ -1237,7 +1238,7 @@ class iz3translation_full : public iz3translation {
if(pr(rew) == PR_REWRITE){
return clause; // just hope the rewrite does nothing!
}
throw unsupported();
throw unsupported(rew);
}


Expand Down Expand Up @@ -1311,7 +1312,7 @@ class iz3translation_full : public iz3translation {

ast commute_equality_iff(const ast &con){
if(op(con) != Iff || op(arg(con,0)) != Equal)
throw unsupported();
throw unsupported(con);
return make(Iff,commute_equality(arg(con,0)),commute_equality(arg(con,1)));
}

Expand All @@ -1337,7 +1338,7 @@ class iz3translation_full : public iz3translation {
prs.push_back(con);
return clone(proof,prs);
default:
throw unsupported();
throw unsupported(proof);
}
}

Expand Down Expand Up @@ -1837,7 +1838,7 @@ class iz3translation_full : public iz3translation {
for(unsigned i = 0; i < nprems; i++)
if(sym(args[i]) == commute
&& !(dk == PR_TRANSITIVITY || dk == PR_MODUS_PONENS || dk == PR_SYMMETRY || (dk == PR_MONOTONICITY && op(arg(con,0)) == Not)))
throw unsupported();
throw unsupported(proof);

switch(dk){
case PR_TRANSITIVITY: {
Expand Down Expand Up @@ -1908,7 +1909,7 @@ class iz3translation_full : public iz3translation {
int nargs = num_args(con);
if(farkas_coeffs.size() != (unsigned)nargs){
pfgoto(proof);
throw unsupported();
throw unsupported(proof);
}
for(int i = 0; i < nargs; i++){
ast lit = mk_not(arg(con,i));
Expand Down Expand Up @@ -1946,7 +1947,7 @@ class iz3translation_full : public iz3translation {
get_broken_gcd_test_coeffs(proof,farkas_coeffs);
if(farkas_coeffs.size() != nprems){
pfgoto(proof);
throw unsupported();
throw unsupported(proof);
}
std::vector<Iproof::node> my_prems; my_prems.resize(2);
std::vector<ast> my_prem_cons; my_prem_cons.resize(2);
Expand All @@ -1969,7 +1970,7 @@ class iz3translation_full : public iz3translation {
if(args.size() > 0)
res = GomoryCutRule2Farkas(proof, conc(proof), args);
else
throw unsupported();
throw unsupported(proof);
break;
}
case EqPropagateKind: {
Expand All @@ -1988,7 +1989,7 @@ class iz3translation_full : public iz3translation {
break;
}
default:
throw unsupported();
throw unsupported(proof);
}
break;
case ArrayTheory: {// nothing fancy for this
Expand All @@ -2000,7 +2001,7 @@ class iz3translation_full : public iz3translation {
break;
}
default:
throw unsupported();
throw unsupported(proof);
}
break;
}
Expand All @@ -2024,7 +2025,7 @@ class iz3translation_full : public iz3translation {
if(is_local(con))
res = args[0];
else
throw unsupported();
throw unsupported(con);
break;
}
case PR_COMMUTATIVITY: {
Expand All @@ -2048,7 +2049,7 @@ class iz3translation_full : public iz3translation {
IF_VERBOSE(0, verbose_stream() << "Unsupported proof rule: " << expr_ref((expr*)proof.raw(), *proof.mgr()) << "\n";);
// pfgoto(proof);
// SASSERT(0 && "translate_main: unsupported proof rule");
throw unsupported();
throw unsupported(proof);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/interp/iz3translate.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class iz3translation : public iz3base {

/** This is thrown when the proof cannot be translated. */
struct unsupported: public iz3_exception {
unsupported(): iz3_exception("unsupported") { }
raw_ast* m_ast;
unsupported(ast const& a): iz3_exception("unsupported"), m_ast(a.raw()) { }
};

static iz3translation *create(iz3mgr &mgr,
Expand Down
2 changes: 2 additions & 0 deletions src/sat/sat_clause.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ namespace sat {
m_frozen(false),
m_reinit_stack(false),
m_inact_rounds(0) {
m_psm = 0;
m_glue = 0;
memcpy(m_lits, lits, sizeof(literal) * sz);
mark_strengthened();
SASSERT(check_approx());
Expand Down
5 changes: 1 addition & 4 deletions src/sat/sat_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2460,10 +2460,7 @@ namespace sat {
// try to use cached implication if available
literal_vector * implied_lits = m_probing.cached_implied_lits(~l);
if (implied_lits) {
literal_vector::iterator it = implied_lits->begin();
literal_vector::iterator end = implied_lits->end();
for (; it != end; ++it) {
literal l2 = *it;
for (literal l2 : *implied_lits) {
// Here, we must check l0 != ~l2.
// l \/ l2 is an implied binary clause.
// However, it may have been deduced using a lemma that has been deleted.
Expand Down

0 comments on commit 20d6543

Please sign in to comment.