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]

[patch] Fix gnat.dg/aliasing2.adb regression


The test doesn't pass anymore because the flag TYPE_NONALIASED_COMPONENT isn't 
effective anymore in Ada.  It technically still works but all array types are 
now given alias set 0 in Ada; this is because all unconstrained array types 
are now TYPE_STRUCTURAL_EQUALITY_P, as their index type also is.

The latter setting was changed when build_range_type and build_index_type were 
merged; the former didn't set TYPE_STRUCTURAL_EQUALITY_P, the latter did.

I don't think we need to set TYPE_STRUCTURAL_EQUALITY_P on range types with 
self-referential bounds as they cannot be merged in any case.  This is enough 
to fix the regression.

LTO-bootstrapped/regested on x86_64-suse-linux, OK for the mainline?


2010-11-29  Eric Botcazou  <ebotcazou@adacore.com>

	* tree.c (build_range_type_1): Do not set TYPE_STRUCTURAL_EQUALITY_P
	because of self-referential bounds.


-- 
Eric Botcazou
Index: tree.c
===================================================================
--- tree.c	(revision 167201)
+++ tree.c	(working copy)
@@ -7110,9 +7110,11 @@ build_range_type_1 (tree type, tree lowv
   TYPE_USER_ALIGN (itype) = TYPE_USER_ALIGN (type);
 
   if ((TYPE_MIN_VALUE (itype)
-       && TREE_CODE (TYPE_MIN_VALUE (itype)) != INTEGER_CST)
+       && TREE_CODE (TYPE_MIN_VALUE (itype)) != INTEGER_CST
+       && !CONTAINS_PLACEHOLDER_P (TYPE_MIN_VALUE (itype)))
       || (TYPE_MAX_VALUE (itype)
-	  && TREE_CODE (TYPE_MAX_VALUE (itype)) != INTEGER_CST))
+	  && TREE_CODE (TYPE_MAX_VALUE (itype)) != INTEGER_CST
+	  && !CONTAINS_PLACEHOLDER_P (TYPE_MAX_VALUE (itype))))
     {
       /* Since we cannot reliably merge this type, we need to compare it using
 	 structural equality checks.  */

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