Fix bug 512: an assertion failure only appearing with clang on Mac OS, due to imprope...
authorMorgan Deters <mdeters@cs.nyu.edu>
Tue, 21 May 2013 22:39:33 +0000 (18:39 -0400)
committerMorgan Deters <mdeters@cs.nyu.edu>
Tue, 21 May 2013 22:58:25 +0000 (18:58 -0400)
src/theory/theory_engine.cpp
src/util/ite_removal.cpp
test/regress/regress0/Makefile.am
test/regress/regress0/bug512.minimized.smt2 [new file with mode: 0644]

index ee37f331ee9d60b865772e704e62c5b56b9ad1a0..53f5d10f300787da85cbc154a7729d2e4395d968 100644 (file)
@@ -1311,6 +1311,18 @@ theory::LemmaStatus TheoryEngine::lemma(TNode node, bool negated, bool removable
   d_iteRemover.run(additionalLemmas, iteSkolemMap);
   additionalLemmas[0] = theory::Rewriter::rewrite(additionalLemmas[0]);
 
+  if(Trace.isOn("lemma-ites")) {
+    Debug("lemma-ites") << "removed ITEs from lemma: " << node << std::endl;
+    Debug("lemma-ites") << " + now have the following "
+                        << additionalLemmas.size() << " lemma(s):" << std::endl;
+    for(std::vector<Node>::const_iterator i = additionalLemmas.begin();
+        i != additionalLemmas.end();
+        ++i) {
+      Debug("lemma-ites") << " + " << *i << std::endl;
+    }
+    Debug("lemma-ites") << std::endl;
+  }
+
   // assert to prop engine
   d_propEngine->assertLemma(additionalLemmas[0], negated, removable);
   for (unsigned i = 1; i < additionalLemmas.size(); ++ i) {
index f26bbe0aa7453d5393fcfb23fc351f8e2c4ba012..7d49482512b6f40fafc83ac2f7233c2f23499a3c 100644 (file)
@@ -30,7 +30,11 @@ void RemoveITE::run(std::vector<Node>& output, IteSkolemMap& iteSkolemMap)
 {
   for (unsigned i = 0, i_end = output.size(); i < i_end; ++ i) {
     std::vector<Node> quantVar;
-    output[i] = run(output[i], output, iteSkolemMap, quantVar);
+    // Do this in two steps to avoid Node problems(?)
+    // Appears related to bug 512, splitting this into two lines
+    // fixes the bug on clang on Mac OS
+    Node itesRemoved = run(output[i], output, iteSkolemMap, quantVar);
+    output[i] = itesRemoved;
   }
 }
 
index 4c14de996904c48ca33ce705d01cd1dd9d495bbc..6cdd184030cd75d1ec4723ded9d65790ce30a8dd 100644 (file)
@@ -151,7 +151,8 @@ BUG_TESTS = \
        bug484.smt2 \
        bug486.cvc \
        bug497.cvc \
-       bug507.smt2
+       bug507.smt2 \
+       bug512.minimized.smt2
 
 TESTS =        $(SMT_TESTS) $(SMT2_TESTS) $(CVC_TESTS) $(TPTP_TESTS) $(BUG_TESTS)
 
diff --git a/test/regress/regress0/bug512.minimized.smt2 b/test/regress/regress0/bug512.minimized.smt2
new file mode 100644 (file)
index 0000000..5fcbf5a
--- /dev/null
@@ -0,0 +1,8 @@
+; EXPECT: unknown
+; EXIT: 0
+(set-logic UF)
+(declare-sort T 0)
+(declare-fun bool_2_U (Bool) T)
+(declare-fun U_2_bool (T) Bool)
+(assert (forall ((x T)) (= (bool_2_U (U_2_bool x)) x)))
+(check-sat)