3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-19 10:52:02 +00:00

fix crash bugs in sat solver

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-11-11 11:25:43 -08:00
parent c522487a86
commit a6da207b65
10 changed files with 133 additions and 43 deletions

View file

@ -27,8 +27,9 @@ namespace sat {
for (; it != end; ++it) {
if (it->is_clause() && it->get_clause_offset() == c) {
watch_list::iterator it2 = it;
++it;
++it;
for (; it != end; ++it) {
SASSERT(!((it->is_clause() && it->get_clause_offset() == c)));
*it2 = *it;
++it2;
}
@ -40,27 +41,26 @@ namespace sat {
}
std::ostream& display_watch_list(std::ostream & out, clause_allocator const & ca, watch_list const & wlist) {
watch_list::const_iterator it = wlist.begin();
watch_list::const_iterator end = wlist.end();
for (bool first = true; it != end; ++it) {
bool first = true;
for (watched const& w : wlist) {
if (first)
first = false;
else
out << " ";
switch (it->get_kind()) {
switch (w.get_kind()) {
case watched::BINARY:
out << it->get_literal();
if (it->is_learned())
out << w.get_literal();
if (w.is_learned())
out << "*";
break;
case watched::TERNARY:
out << "(" << it->get_literal1() << " " << it->get_literal2() << ")";
out << "(" << w.get_literal1() << " " << w.get_literal2() << ")";
break;
case watched::CLAUSE:
out << "(" << it->get_blocked_literal() << " " << *(ca.get_clause(it->get_clause_offset())) << ")";
out << "(" << w.get_blocked_literal() << " " << *(ca.get_clause(w.get_clause_offset())) << ")";
break;
case watched::EXT_CONSTRAINT:
out << "ext: " << it->get_ext_constraint_idx();
out << "ext: " << w.get_ext_constraint_idx();
break;
default:
UNREACHABLE();