Skip to content

Commit b34f38c

Browse files
committed
SMT2 back-end: do not flatten flattened arrays
convert_expr may flatten an array anyway, in which case flatten_array would generate select statements over bitvectors instead of arrays (as flatten_array itself invokes convert_expr to supposedly construct the array expression).
1 parent dd7713f commit b34f38c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/solvers/smt2/smt2_conv.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,7 +3142,16 @@ void smt2_convt::convert_struct(const struct_exprt &expr)
31423142
else
31433143
{
31443144
if(components.size()==1)
3145-
convert_expr(expr.op0());
3145+
{
3146+
const exprt &op = expr.op0();
3147+
// may need to flatten array-theory arrays in there
3148+
if(op.type().id() == ID_array && use_array_theory(op))
3149+
flatten_array(op);
3150+
else if(op.type().id() == ID_bool)
3151+
flatten2bv(op);
3152+
else
3153+
convert_expr(op);
3154+
}
31463155
else
31473156
{
31483157
// SMT-LIB 2 concat is binary only
@@ -3153,7 +3162,7 @@ void smt2_convt::convert_struct(const struct_exprt &expr)
31533162
exprt op=expr.operands()[i-1];
31543163

31553164
// may need to flatten array-theory arrays in there
3156-
if(op.type().id() == ID_array)
3165+
if(op.type().id() == ID_array && use_array_theory(op))
31573166
flatten_array(op);
31583167
else if(op.type().id() == ID_bool)
31593168
flatten2bv(op);

0 commit comments

Comments
 (0)