Avoid printing success for `--force-logic` (#3363)
authorAndres Noetzli <andres.noetzli@gmail.com>
Wed, 9 Oct 2019 06:24:42 +0000 (23:24 -0700)
committerGitHub <noreply@github.com>
Wed, 9 Oct 2019 06:24:42 +0000 (23:24 -0700)
CVC4 was printing success when `--force-logic` was used because
internally, `--force-logic` generates a `SetBenchmarkLogicCommand`. This
caused issues with the SMT-COMP trace executor. This commit fixes the
behavior by muting the command if it was not issued by the user.

The issue was likely introduced with #3062.

src/parser/smt2/smt2.cpp
test/regress/CMakeLists.txt
test/regress/regress0/parser/force_logic_success.smt2 [new file with mode: 0644]

index ba512ded9aa4607d282c6a4b968b7485488b7f63..ffda05d1a715507581f241f5bb44192f50470a36 100644 (file)
@@ -837,14 +837,9 @@ Command* Smt2::setLogic(std::string name, bool fromCommand)
     addTheory(THEORY_SEP);
   }
 
-  if (sygus())
-  {
-    return new SetBenchmarkLogicCommand(d_logic.getLogicString());
-  }
-  else
-  {
-    return new SetBenchmarkLogicCommand(name);
-  }
+  Command* cmd = new SetBenchmarkLogicCommand(sygus() ? d_logic.getLogicString() : name);
+  cmd->setMuted(!fromCommand);
+  return cmd;
 } /* Smt2::setLogic() */
 
 bool Smt2::sygus() const
index 7951a9c41c4d6532bb35f4af132159b7c0435eb8..96de4bafc92496c6dbf444a93af395190343b8d9 100644 (file)
@@ -561,6 +561,7 @@ set(regress_0_tests
   regress0/parser/constraint.smt2
   regress0/parser/declarefun-emptyset-uf.smt2
   regress0/parser/force_logic_set_logic.smt2
+  regress0/parser/force_logic_success.smt2
   regress0/parser/shadow_fun_symbol_all.smt2
   regress0/parser/shadow_fun_symbol_nirat.smt2
   regress0/parser/strings20.smt2
diff --git a/test/regress/regress0/parser/force_logic_success.smt2 b/test/regress/regress0/parser/force_logic_success.smt2
new file mode 100644 (file)
index 0000000..027d7cc
--- /dev/null
@@ -0,0 +1,5 @@
+; COMMAND-LINE: --force-logic QF_BV --print-success
+; EXPECT: success
+; EXPECT: sat
+(assert true)
+(check-sat)