This is the mail archive of the
mailing list for the GCC project.
[Ada] Fix aliasing bug with fat pointer types
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 23 Jul 2010 22:20:18 +0200
- Subject: [Ada] Fix aliasing bug with fat pointer types
We have a complex machinery in gigi to handle forward declarations of fat
pointer types, i.e. pointers to unconstrained arrays. They aren't pointers
per se, only records containing a pair of pointers, but we try to emulate the
behavior of pointers as much as possible for them.
There is a bug when the old and new versions of such pointers are merged in
update_pointer_to: we fail to merge the alias set.
Fixed thusly, tested on x86-64-suse-linux, applied on the mainline.
2010-07-23 Eric Botcazou <email@example.com>
* gcc-interfaces/utils.c (update_pointer_to): In the unconstrained
array case, merge the alias set of the old pointer type.
--- gcc-interface/utils.c (revision 162485)
+++ gcc-interface/utils.c (working copy)
@@ -3510,6 +3510,7 @@ update_pointer_to (tree old_type, tree n
DECL_FIELD_CONTEXT (bounds_field) = new_ptr;
for (t = new_ptr; t; last = t, t = TYPE_NEXT_VARIANT (t))
TYPE_FIELDS (t) = TYPE_FIELDS (ptr);
+ TYPE_ALIAS_SET (new_ptr) = TYPE_ALIAS_SET (ptr);
/* Chain PTR and its variants at the end. */
TYPE_NEXT_VARIANT (last) = TYPE_MAIN_VARIANT (ptr);