[Ada] Fix aliasing bug with fat pointer types

Message ID 201007232220.19172.ebotcazou@adacore.com
State New
Headers show

Commit Message

Eric Botcazou July 23, 2010, 8:20 p.m.
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  <ebotcazou@adacore.com>

	* gcc-interfaces/utils.c (update_pointer_to): In the unconstrained
	array case, merge the alias set of the old pointer type.


Index: gcc-interface/utils.c
--- 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_ALIAS_SET (new_ptr) = TYPE_ALIAS_SET (ptr);
       /* Chain PTR and its variants at the end.  */