Skip to content

Commit b96dcad

Browse files
committed
SMT2 back-end: ite-conversion must uphold type consistency
WITH expressions in an ite expression could previously trigger one-sided expression flattening.
1 parent 9a1df4b commit b96dcad

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/solvers/smt2/smt2_conv.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,9 +1407,35 @@ void smt2_convt::convert_expr(const exprt &expr)
14071407
out << "(ite ";
14081408
convert_expr(if_expr.cond());
14091409
out << " ";
1410-
convert_expr(if_expr.true_case());
1410+
if(
1411+
expr.type().id() == ID_array && !use_array_theory(if_expr.true_case()) &&
1412+
use_array_theory(if_expr.false_case()))
1413+
{
1414+
unflatten(wheret::BEGIN, expr.type());
1415+
1416+
convert_expr(if_expr.true_case());
1417+
1418+
unflatten(wheret::END, expr.type());
1419+
}
1420+
else
1421+
{
1422+
convert_expr(if_expr.true_case());
1423+
}
14111424
out << " ";
1412-
convert_expr(if_expr.false_case());
1425+
if(
1426+
expr.type().id() == ID_array && use_array_theory(if_expr.true_case()) &&
1427+
!use_array_theory(if_expr.false_case()))
1428+
{
1429+
unflatten(wheret::BEGIN, expr.type());
1430+
1431+
convert_expr(if_expr.false_case());
1432+
1433+
unflatten(wheret::END, expr.type());
1434+
}
1435+
else
1436+
{
1437+
convert_expr(if_expr.false_case());
1438+
}
14131439
out << ")";
14141440
}
14151441
else if(expr.id()==ID_and ||

0 commit comments

Comments
 (0)