From: Gereon Kremer Date: Wed, 19 Aug 2020 13:04:53 +0000 (+0200) Subject: Fix SmtEngine::reset() (#4917) X-Git-Tag: cvc5-1.0.0~2981 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=533f87dc6cf44a7bcb84694a5c21e5280425be93;p=cvc5.git Fix SmtEngine::reset() (#4917) Calling (reset) multiple times produced parsing problems (#4866) and could probably lead to all kinds of interesting issues. In a nutshell, reset() failed to properly reset d_initialOptions (which is used to properly reset d_options) so that all options defaulted after the second call to reset(). This PR properly sets d_initialOptions after a reset (and the filename as well). Fixes #4866. --- diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp index 83f3cb5e0..d4b7eecbf 100644 --- a/src/smt/smt_engine.cpp +++ b/src/smt/smt_engine.cpp @@ -2101,10 +2101,13 @@ void SmtEngine::reset() if(Dump.isOn("benchmark")) { Dump("benchmark") << ResetCommand(); } + std::string filename = d_state->getFilename(); Options opts; opts.copyValues(d_originalOptions); this->~SmtEngine(); new (this) SmtEngine(em, &opts); + // Restore data set after creation + notifyStartParsing(filename); } void SmtEngine::resetAssertions() diff --git a/test/regress/CMakeLists.txt b/test/regress/CMakeLists.txt index a21b76b0c..8ca9d74c3 100644 --- a/test/regress/CMakeLists.txt +++ b/test/regress/CMakeLists.txt @@ -946,6 +946,7 @@ set(regress_0_tests regress0/smtlib/issue4077.smt2 regress0/smtlib/issue4151.smt2 regress0/smtlib/issue4552.smt2 + regress0/smtlib/issue4866.smt2 regress0/smtlib/reason-unknown.smt2 regress0/smtlib/reset.smt2 regress0/smtlib/reset-assertions1.smt2 diff --git a/test/regress/regress0/smtlib/issue4866.smt2 b/test/regress/regress0/smtlib/issue4866.smt2 new file mode 100644 index 000000000..1bbe25dc6 --- /dev/null +++ b/test/regress/regress0/smtlib/issue4866.smt2 @@ -0,0 +1,6 @@ +; EXIT: 0 +; EXPECT: +; Test triple reset. There was a bug with restoring options on reset. +(reset) +(reset) +(reset)