@@ -249,11 +249,12 @@ exprt deref_expr(const exprt &expr)
249
249
return dereference_exprt (expr);
250
250
}
251
251
252
- void clean_pointer_expr (exprt &expr, const typet &type )
252
+ void clean_pointer_expr (exprt &expr)
253
253
{
254
254
if (
255
- can_cast_type<array_typet>(type) && can_cast_expr<symbol_exprt>(expr) &&
256
- to_array_type (type).size ().get_bool (ID_C_SSA_symbol))
255
+ can_cast_type<array_typet>(expr.type ()) &&
256
+ can_cast_expr<symbol_exprt>(expr) &&
257
+ to_array_type (expr.type ()).size ().get_bool (ID_C_SSA_symbol))
257
258
{
258
259
remove_array_type_l2 (expr.type ());
259
260
exprt original_expr = to_ssa_expr (expr).get_original_expr ();
@@ -448,12 +449,17 @@ exprt compute_or_over_bytes(
448
449
can_cast_type<c_bool_typet>(field_type) ||
449
450
can_cast_type<bool_typet>(field_type),
450
451
" Can aggregate bytes with *or* only if the shadow memory type is _Bool." );
451
- const typet type = ns.follow (expr.type ());
452
452
453
- if (type.id () == ID_struct || type.id () == ID_union)
453
+ if (
454
+ expr.type ().id () == ID_struct || expr.type ().id () == ID_union ||
455
+ expr.type ().id () == ID_struct_tag || expr.type ().id () == ID_union_tag)
454
456
{
457
+ const auto &components =
458
+ (expr.type ().id () == ID_struct_tag || expr.type ().id () == ID_union_tag)
459
+ ? ns.follow_tag (to_struct_or_union_tag_type (expr.type ())).components ()
460
+ : to_struct_union_type (expr.type ()).components ();
455
461
exprt::operandst values;
456
- for (const auto &component : to_struct_union_type (type). components () )
462
+ for (const auto &component : components)
457
463
{
458
464
if (component.get_is_padding ())
459
465
{
@@ -464,9 +470,9 @@ exprt compute_or_over_bytes(
464
470
}
465
471
return or_values (values, field_type);
466
472
}
467
- else if (type.id () == ID_array)
473
+ else if (expr. type () .id () == ID_array)
468
474
{
469
- const array_typet &array_type = to_array_type (type);
475
+ const array_typet &array_type = to_array_type (expr. type () );
470
476
if (array_type.size ().is_constant ())
471
477
{
472
478
exprt::operandst values;
@@ -495,7 +501,10 @@ exprt compute_or_over_bytes(
495
501
if (is_union)
496
502
{
497
503
extract_bytes_of_bv (
498
- conditional_cast_floatbv_to_unsignedbv (expr), type, field_type, values);
504
+ conditional_cast_floatbv_to_unsignedbv (expr),
505
+ expr.type (),
506
+ field_type,
507
+ values);
499
508
}
500
509
else
501
510
{
@@ -998,11 +1007,14 @@ normalize(const object_descriptor_exprt &expr, const namespacet &ns)
998
1007
else if (object.id () == ID_member)
999
1008
{
1000
1009
const member_exprt &member_expr = to_member_expr (object);
1010
+ const auto &struct_op = member_expr.struct_op ();
1001
1011
const struct_typet &struct_type =
1002
- to_struct_type (ns.follow (member_expr.struct_op ().type ()));
1012
+ struct_op.type ().id () == ID_struct_tag
1013
+ ? ns.follow_tag (to_struct_tag_type (struct_op.type ()))
1014
+ : to_struct_type (struct_op.type ());
1003
1015
offset +=
1004
1016
*member_offset (struct_type, member_expr.get_component_name (), ns);
1005
- object = member_expr. struct_op () ;
1017
+ object = struct_op;
1006
1018
}
1007
1019
else
1008
1020
{
0 commit comments