Fix assertion failure due to missing clause id (#180)
authorAndres Nötzli <andres.noetzli@gmail.com>
Fri, 23 Jun 2017 06:56:45 +0000 (23:56 -0700)
committerGitHub <noreply@github.com>
Fri, 23 Jun 2017 06:56:45 +0000 (23:56 -0700)
This commit fixes bug 821. As written in the description of the bug, the issue
is that `id` is not being set on one of the paths in addClause(), specifically
in the case where all but one literal are assigned false and the remaining
literal is assigned true. In that case, we are not actually adding anything and
set the `id` to `ClauseIdUndef`.

src/prop/minisat/core/Solver.cc
test/regress/regress0/push-pop/Makefile.am
test/regress/regress0/push-pop/bug821.smt2 [new file with mode: 0644]

index 26af5f1467ebf5f240b58c0bafb10f05232e0e0c..0bf5d5d7cea40060e8f13a2cfef72e95c16ea56b 100644 (file)
@@ -428,7 +428,10 @@ bool Solver::addClause_(vec<Lit>& ps, bool removable, ClauseId& id)
             }
           }
           return ok;
-        } else return ok;
+        } else {
+          PROOF(id = ClauseIdUndef;);
+          return ok;
+        }
       }
     }
 
index 197f81d63b799c1ec44a87253628aec9ea2afa42..0f250814411cf9f851ca15c8f7072242e387668e 100644 (file)
@@ -49,7 +49,8 @@ BUG_TESTS = \
   bug765.smt2 \
   bug691.smt2 \
   bug694-Unapply1.scala-0.smt2 \
-  simple_unsat_cores.smt2
+  simple_unsat_cores.smt2 \
+  bug821.smt2
 
 TESTS =        $(SMT_TESTS) $(SMT2_TESTS) $(CVC_TESTS) $(BUG_TESTS)
 
diff --git a/test/regress/regress0/push-pop/bug821.smt2 b/test/regress/regress0/push-pop/bug821.smt2
new file mode 100644 (file)
index 0000000..b537197
--- /dev/null
@@ -0,0 +1,8 @@
+; COMMAND-LINE: --incremental
+; EXPECT: sat
+(set-logic UF)
+(push 1)
+(declare-fun _substvar_4_ () Bool)
+(assert _substvar_4_)
+(assert _substvar_4_)
+(check-sat)