Skip to content

Commit 691ace0

Browse files
author
Daniel Kroening
committed
smt2_solver: do not give potentially broken expressions to decision procedure
1 parent ac23473 commit 691ace0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/solvers/smt2/smt2_solver.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ void smt2_solvert::command(const std::string &c)
126126
if(c=="assert")
127127
{
128128
exprt e=expression();
129-
if(e.is_not_nil())
129+
if(!ok)
130+
{
131+
ok = true;
132+
}
133+
else if(e.is_not_nil())
130134
{
131135
expand_function_applications(e);
132136
define_constants(e);
@@ -157,7 +161,9 @@ void smt2_solvert::command(const std::string &c)
157161
{
158162
// this is a command that Z3 appears to implement
159163
exprt e=expression();
160-
if(e.is_not_nil())
164+
if(!ok)
165+
ok = true;
166+
else if(e.is_not_nil())
161167
{
162168
std::cout << e.pretty() << '\n'; // need to do an 'smt2_format'
163169
}
@@ -166,7 +172,9 @@ void smt2_solvert::command(const std::string &c)
166172
{
167173
// this is a command that Z3 appears to implement
168174
exprt e=expression();
169-
if(e.is_not_nil())
175+
if(!ok)
176+
ok = true;
177+
else if(e.is_not_nil())
170178
{
171179
const symbol_tablet symbol_table;
172180
const namespacet ns(symbol_table);

0 commit comments

Comments
 (0)