File tree Expand file tree Collapse file tree 4 files changed +29
-5
lines changed
Expand file tree Collapse file tree 4 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 1- CORE broken-smt-backend
1+ CORE
22union_initialization.c
33
44^EXIT=10$
Original file line number Diff line number Diff line change 1- CORE broken-smt-backend
1+ CORE broken-z3- smt-backend
22union_member.c
33
44^EXIT=10$
Original file line number Diff line number Diff line change 1- CORE broken-smt-backend
1+ CORE broken-z3- smt-backend
22union_update.c
33
44^EXIT=10$
Original file line number Diff line number Diff line change @@ -4556,7 +4556,31 @@ void smt2_convt::flatten2bv(const exprt &expr)
45564556 }
45574557 else if (type.id ()==ID_array)
45584558 {
4559- convert_expr (expr);
4559+ if (use_array_theory (expr))
4560+ {
4561+ // concatenate elements
4562+ const array_typet &array_type = to_array_type (type);
4563+
4564+ mp_integer size =
4565+ numeric_cast_v<mp_integer>(to_constant_expr (array_type.size ()));
4566+
4567+ out << " (let ((?aflop " ;
4568+ convert_expr (expr);
4569+ out << " )) " ;
4570+
4571+ out << " (concat" ;
4572+
4573+ for (mp_integer i = 0 ; i != size; ++i)
4574+ {
4575+ out << " (select ?aflop " ;
4576+ convert_expr (from_integer (i, array_type.index_type ()));
4577+ out << ' )' ;
4578+ }
4579+
4580+ out << " ))" ; // concat, let
4581+ }
4582+ else
4583+ convert_expr (expr);
45604584 }
45614585 else if (type.id () == ID_struct || type.id () == ID_struct_tag)
45624586 {
@@ -5441,7 +5465,7 @@ bool smt2_convt::use_array_theory(const exprt &expr)
54415465 }
54425466 else
54435467 {
5444- // arrays inside structs get flattened
5468+ // arrays inside structs or unions get flattened
54455469 if (expr.id ()==ID_with)
54465470 return use_array_theory (to_with_expr (expr).old ());
54475471 else if (expr.id ()==ID_member)
You can’t perform that action at this time.
0 commit comments