@@ -98,7 +98,8 @@ static struct_exprt bv_to_struct_expr(
98
98
99
99
if (component_bits == 0 )
100
100
{
101
- operands.push_back (constant_exprt{irep_idt{}, comp.type ()});
101
+ operands.push_back (
102
+ bv_to_expr (bitvector_expr, comp.type (), endianness_map, ns));
102
103
continue ;
103
104
}
104
105
@@ -123,17 +124,16 @@ static struct_exprt bv_to_struct_expr(
123
124
124
125
// / Convert a bitvector-typed expression \p bitvector_expr to a union-typed
125
126
// / expression. See \ref bv_to_expr for an overview.
126
- static union_exprt bv_to_union_expr (
127
+ static exprt bv_to_union_expr (
127
128
const exprt &bitvector_expr,
128
129
const union_typet &union_type,
129
130
const endianness_mapt &endianness_map,
130
131
const namespacet &ns)
131
132
{
132
133
const union_typet::componentst &components = union_type.components ();
133
134
134
- // empty union, handled the same way as done in expr_initializert
135
135
if (components.empty ())
136
- return union_exprt{irep_idt{}, nil_exprt{}, union_type};
136
+ return empty_union_exprt{ union_type};
137
137
138
138
const auto widest_member = union_type.find_widest_union_component (ns);
139
139
@@ -147,7 +147,7 @@ static union_exprt bv_to_union_expr(
147
147
{
148
148
return union_exprt{
149
149
components.front ().get_name (),
150
- constant_exprt{irep_idt{} , components.front ().type ()} ,
150
+ bv_to_expr (bitvector_expr , components.front ().type (), endianness_map, ns) ,
151
151
union_type};
152
152
}
153
153
@@ -371,13 +371,13 @@ static exprt bv_to_expr(
371
371
}
372
372
else if (target_type.id () == ID_union_tag)
373
373
{
374
- union_exprt result = bv_to_union_expr (
374
+ exprt result = bv_to_union_expr (
375
375
bitvector_expr,
376
376
ns.follow_tag (to_union_tag_type (target_type)),
377
377
endianness_map,
378
378
ns);
379
379
result.type () = target_type;
380
- return std::move ( result) ;
380
+ return result;
381
381
}
382
382
else if (target_type.id () == ID_array)
383
383
{
0 commit comments