This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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  <ebotcazou@adacore.com>

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


-- 
Eric Botcazou
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_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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]