Skip to content

Commit

Permalink
Throw exception when IC3 bad state reachability check result is unkno…
Browse files Browse the repository at this point in the history
…wn (#352)

Currently, if the invoked SMT solver returns "unknown," we fail an assertion in debug mode and silently proceed as if it was unsat in release mode. This can happen on e.g. Bitwuzla when there are equalities involving constant arrays. (Other solvers might do this too, although some simply return incorrect results.)
  • Loading branch information
CyanoKobalamyne committed Sep 14, 2024
1 parent b7860db commit d81013d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions engines/ic3base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

#include "engines/ic3base.h"

#include "assert.h"
#include <cassert>

#include "smt/available_solvers.h"
#include "utils/exceptions.h"
#include "utils/logger.h"
#include "utils/term_analysis.h"

using namespace smt;
using namespace std;
Expand Down Expand Up @@ -366,7 +367,10 @@ bool IC3Base::reaches_bad(IC3Formula & out)

pop_solver_context();

assert(!r.is_unknown());
if (r.is_unknown()) {
throw PonoException("Bad state check in IC3 returned unknown");
}

return r.is_sat();
}

Expand Down Expand Up @@ -648,7 +652,7 @@ bool IC3Base::block_all()
} // end while(!proof_goals.empty())

assert(!(goal = IC3Formula()).term); // in debug mode, reset it
} // end while(reaches_bad(goal))
} // end while(reaches_bad(goal))

assert(proof_goals.empty());
return true;
Expand Down

0 comments on commit d81013d

Please sign in to comment.