@@ -249,11 +249,12 @@ exprt deref_expr(const exprt &expr)
249249 return dereference_exprt (expr);
250250}
251251
252- void clean_pointer_expr (exprt &expr, const typet &type )
252+ void clean_pointer_expr (exprt &expr)
253253{
254254 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))
257258 {
258259 remove_array_type_l2 (expr.type ());
259260 exprt original_expr = to_ssa_expr (expr).get_original_expr ();
@@ -448,12 +449,17 @@ exprt compute_or_over_bytes(
448449 can_cast_type<c_bool_typet>(field_type) ||
449450 can_cast_type<bool_typet>(field_type),
450451 " Can aggregate bytes with *or* only if the shadow memory type is _Bool." );
451- const typet type = ns.follow (expr.type ());
452452
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)
454456 {
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 ();
455461 exprt::operandst values;
456- for (const auto &component : to_struct_union_type (type). components () )
462+ for (const auto &component : components)
457463 {
458464 if (component.get_is_padding ())
459465 {
@@ -464,9 +470,9 @@ exprt compute_or_over_bytes(
464470 }
465471 return or_values (values, field_type);
466472 }
467- else if (type.id () == ID_array)
473+ else if (expr. type () .id () == ID_array)
468474 {
469- const array_typet &array_type = to_array_type (type);
475+ const array_typet &array_type = to_array_type (expr. type () );
470476 if (array_type.size ().is_constant ())
471477 {
472478 exprt::operandst values;
@@ -495,7 +501,10 @@ exprt compute_or_over_bytes(
495501 if (is_union)
496502 {
497503 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);
499508 }
500509 else
501510 {
@@ -998,11 +1007,14 @@ normalize(const object_descriptor_exprt &expr, const namespacet &ns)
9981007 else if (object.id () == ID_member)
9991008 {
10001009 const member_exprt &member_expr = to_member_expr (object);
1010+ const auto &struct_op = member_expr.struct_op ();
10011011 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 ());
10031015 offset +=
10041016 *member_offset (struct_type, member_expr.get_component_name (), ns);
1005- object = member_expr. struct_op () ;
1017+ object = struct_op;
10061018 }
10071019 else
10081020 {
0 commit comments