Skip to content

Commit 30923ab

Browse files
committed
Also skip flattening zero-sized arrays
when converting to SMT2 queries.
1 parent f585e60 commit 30923ab

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/solvers/smt2/smt2_conv.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -2672,7 +2672,14 @@ void smt2_convt::convert_struct(const struct_exprt &expr)
26722672

26732673
// may need to flatten array-theory arrays in there
26742674
if(op.type().id() == ID_array)
2675-
flatten_array(op);
2675+
{
2676+
const array_typet &array_type = to_array_type(op.type());
2677+
const auto &size_expr = array_type.size();
2678+
CHECK_RETURN(size_expr.id() == ID_constant);
2679+
2680+
if(numeric_cast_v<mp_integer>(to_constant_expr(size_expr)) != 0)
2681+
flatten_array(op);
2682+
}
26762683
else
26772684
convert_expr(op);
26782685

@@ -4526,7 +4533,11 @@ void smt2_convt::convert_type(const typet &type)
45264533
{
45274534
if(use_datatypes)
45284535
{
4529-
out << datatype_map.at(type);
4536+
const typet &struct_type = type.id() == ID_struct_tag
4537+
? ns.follow_tag(to_struct_tag_type(type))
4538+
: type;
4539+
CHECK_RETURN(datatype_map.count(struct_type) > 0);
4540+
out << datatype_map.at(struct_type);
45304541
}
45314542
else
45324543
{

0 commit comments

Comments
 (0)