summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2019-11-13 14:14:09 -0800
committerGitHub <noreply@github.com>2019-11-13 14:14:09 -0800
commit0383980050ab86b1a4f7f265d9c8527e627ef971 (patch)
tree7860df1b0ff8a1bb4cdf908bd491608021be7e96
parent6beda739210b7bd13adbb7f62b0c4361156986ee (diff)
Allow (set-logic ...) after (reset) (#3457)
Fixes #3353. #3062 introduced a flag that tracks whether we have seen a `(set-logic ...)` command to improve the handling of `--force-logic`. However, the flag was not set to `false` when `(reset)` was called. This commit fixes the issue.
-rw-r--r--src/parser/smt2/smt2.cpp1
-rw-r--r--test/regress/CMakeLists.txt2
-rw-r--r--test/regress/regress0/smtlib/reset-force-logic.smt217
-rw-r--r--test/regress/regress0/smtlib/reset-set-logic.smt213
4 files changed, 33 insertions, 0 deletions
diff --git a/src/parser/smt2/smt2.cpp b/src/parser/smt2/smt2.cpp
index f9942049a..8031e81e6 100644
--- a/src/parser/smt2/smt2.cpp
+++ b/src/parser/smt2/smt2.cpp
@@ -610,6 +610,7 @@ void Smt2::pushDefineFunRecScope(
void Smt2::reset() {
d_logicSet = false;
+ d_seenSetLogic = false;
d_logic = LogicInfo();
operatorKindMap.clear();
d_lastNamedTerm = std::pair<Expr, std::string>();
diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt
index aa5329e2f..0d953c19e 100644
--- a/test/regress/CMakeLists.txt
+++ b/test/regress/CMakeLists.txt
@@ -851,6 +851,8 @@ set(regress_0_tests
regress0/smtlib/get-unsat-assumptions.smt2
regress0/smtlib/global-decls.smt2
regress0/smtlib/reason-unknown.smt2
+ regress0/smtlib/reset-force-logic.smt2
+ regress0/smtlib/reset-set-logic.smt2
regress0/smtlib/set-info-status.smt2
regress0/strings/bug001.smt2
regress0/strings/bug002.smt2
diff --git a/test/regress/regress0/smtlib/reset-force-logic.smt2 b/test/regress/regress0/smtlib/reset-force-logic.smt2
new file mode 100644
index 000000000..91aac508a
--- /dev/null
+++ b/test/regress/regress0/smtlib/reset-force-logic.smt2
@@ -0,0 +1,17 @@
+; COMMAND-LINE: --force-logic QF_LIRA
+; EXPECT: sat
+; EXPECT: sat
+
+; Intentionally set the wrong logic
+(set-logic QF_BV)
+(declare-const x Real)
+(assert (= x (- 2.5)))
+(check-sat)
+
+(reset)
+
+; Intentionally set the wrong logic
+(set-logic QF_BV)
+(declare-const x Int)
+(assert (= x 2))
+(check-sat)
diff --git a/test/regress/regress0/smtlib/reset-set-logic.smt2 b/test/regress/regress0/smtlib/reset-set-logic.smt2
new file mode 100644
index 000000000..361af3d62
--- /dev/null
+++ b/test/regress/regress0/smtlib/reset-set-logic.smt2
@@ -0,0 +1,13 @@
+; EXPECT: sat
+; EXPECT: sat
+(set-logic QF_LRA)
+(declare-const x Real)
+(assert (= x (- 2.5)))
+(check-sat)
+
+(reset)
+
+(set-logic QF_LIA)
+(declare-const x Int)
+(assert (= x 2))
+(check-sat)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback