Skip to content

Commit 71fc87d

Browse files
committed
get_subexpression_at_offset: use typecast_exprt for pointer-to-pointer casts
This signals that the cast is cleaner than a general byte-extract a little more clearly
1 parent 1060c57 commit 71fc87d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/util/pointer_offset_size.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,13 @@ exprt get_subexpression_at_offset(
655655
return result;
656656
}
657657

658+
if(
659+
offset_bytes == 0 && expr.type().id() == ID_pointer &&
660+
target_type_raw.id() == ID_pointer)
661+
{
662+
return typecast_exprt(expr, target_type_raw);
663+
}
664+
658665
const typet &source_type = ns.follow(expr.type());
659666
const auto target_size_bits = pointer_offset_bits(target_type_raw, ns);
660667
if(!target_size_bits.has_value())

0 commit comments

Comments
 (0)