@@ -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,19 @@ 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
459
+ ? ns.follow_tag (to_struct_tag_type (expr.type ())).components ()
460
+ : expr.type ().id () == ID_union_tag
461
+ ? ns.follow_tag (to_union_tag_type (expr.type ())).components ()
462
+ : to_struct_union_type (expr.type ()).components ();
455
463
exprt::operandst values;
456
- for (const auto &component : to_struct_union_type (type). components () )
464
+ for (const auto &component : components)
457
465
{
458
466
if (component.get_is_padding ())
459
467
{
@@ -464,9 +472,9 @@ exprt compute_or_over_bytes(
464
472
}
465
473
return or_values (values, field_type);
466
474
}
467
- else if (type.id () == ID_array)
475
+ else if (expr. type () .id () == ID_array)
468
476
{
469
- const array_typet &array_type = to_array_type (type);
477
+ const array_typet &array_type = to_array_type (expr. type () );
470
478
if (array_type.size ().is_constant ())
471
479
{
472
480
exprt::operandst values;
@@ -495,7 +503,10 @@ exprt compute_or_over_bytes(
495
503
if (is_union)
496
504
{
497
505
extract_bytes_of_bv (
498
- conditional_cast_floatbv_to_unsignedbv (expr), type, field_type, values);
506
+ conditional_cast_floatbv_to_unsignedbv (expr),
507
+ expr.type (),
508
+ field_type,
509
+ values);
499
510
}
500
511
else
501
512
{
@@ -998,11 +1009,14 @@ normalize(const object_descriptor_exprt &expr, const namespacet &ns)
998
1009
else if (object.id () == ID_member)
999
1010
{
1000
1011
const member_exprt &member_expr = to_member_expr (object);
1012
+ const auto &struct_op = member_expr.struct_op ();
1001
1013
const struct_typet &struct_type =
1002
- to_struct_type (ns.follow (member_expr.struct_op ().type ()));
1014
+ struct_op.type ().id () == ID_struct_tag
1015
+ ? ns.follow_tag (to_struct_tag_type (struct_op.type ()))
1016
+ : to_struct_type (struct_op.type ());
1003
1017
offset +=
1004
1018
*member_offset (struct_type, member_expr.get_component_name (), ns);
1005
- object = member_expr. struct_op () ;
1019
+ object = struct_op;
1006
1020
}
1007
1021
else
1008
1022
{
0 commit comments