From 9be1d8fe09cdc0e5b5b3478f7dab16a218802ec1 Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Thu, 10 Mar 2011 07:28:32 +0000 Subject: [PATCH] ITE removal in TheoryEngine was not properly handling PARAMETERIZED kinds. Fixed and added bug regression. Thanks Andrew Reynolds for the bug report! --- src/theory/theory_engine.cpp | 6 ++++++ test/regress/regress0/Makefile.am | 3 ++- test/regress/regress0/buggy-ite.smt2 | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/regress/regress0/buggy-ite.smt2 diff --git a/src/theory/theory_engine.cpp b/src/theory/theory_engine.cpp index 3c59b43e4..f8eece3df 100644 --- a/src/theory/theory_engine.cpp +++ b/src/theory/theory_engine.cpp @@ -310,6 +310,12 @@ Node TheoryEngine::removeITEs(TNode node) { } vector newChildren; bool somethingChanged = false; + if(node.getMetaKind() == kind::metakind::PARAMETERIZED) { + // Make sure to push operator or it will be missing in new + // (reformed) node. This was crashing on the very simple input + // "(f (ite c 0 1))" + newChildren.push_back(node.getOperator()); + } for(TNode::const_iterator it = node.begin(), end = node.end(); it != end; ++it) { diff --git a/test/regress/regress0/Makefile.am b/test/regress/regress0/Makefile.am index 50c43fcb9..37020d48e 100644 --- a/test/regress/regress0/Makefile.am +++ b/test/regress/regress0/Makefile.am @@ -86,7 +86,8 @@ BUG_TESTS = \ bug187.smt2 \ bug216.smt2 \ bug220.smt2 \ - bug239.smt + bug239.smt \ + buggy-ite.smt2 TESTS = $(SMT_TESTS) $(SMT2_TESTS) $(CVC_TESTS) $(BUG_TESTS) diff --git a/test/regress/regress0/buggy-ite.smt2 b/test/regress/regress0/buggy-ite.smt2 new file mode 100644 index 000000000..79e91b55e --- /dev/null +++ b/test/regress/regress0/buggy-ite.smt2 @@ -0,0 +1,13 @@ +; This was causing trouble in CVC4 r1434 due to mishandling of ITE +; removal for PARAMETERIZED kinds. +; Thanks to Andrew Reynolds for catching this. +(set-logic QF_UF) +(set-info :smt-lib-version 2.0) +(set-info :status sat) +(declare-sort U 0) +(declare-fun a () U) +(declare-fun c () Bool) +(declare-fun g (U) Bool) +(assert (g (ite c a a))) +(check-sat) +(exit) -- 2.30.2