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]

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


> Sooo - can you check sth along the above instead?

OK, I acted boldly and tested the complete change. :-)  Bootstrapped/regtested 
and LTO-bootstrapped (for C/Ada) on x86_64-suse-linux, OK for mainline?


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

	* tree.c (build_range_type_1): Do not SET_TYPE_STRUCTURAL_EQUALITY.
	(build_array_type_1): Do not consider TYPE_STRUCTURAL_EQUALITY_P and
	TYPE_CANONICAL for the index type.


-- 
Eric Botcazou
Index: tree.c
===================================================================
--- tree.c	(revision 167201)
+++ tree.c	(working copy)
@@ -7096,6 +7096,7 @@ static tree
 build_range_type_1 (tree type, tree lowval, tree highval, bool shared)
 {
   tree itype = make_node (INTEGER_TYPE);
+  hashval_t hashcode = 0;
 
   TREE_TYPE (itype) = type;
 
@@ -7109,24 +7110,17 @@ build_range_type_1 (tree type, tree lowv
   TYPE_ALIGN (itype) = TYPE_ALIGN (type);
   TYPE_USER_ALIGN (itype) = TYPE_USER_ALIGN (type);
 
-  if ((TYPE_MIN_VALUE (itype)
-       && TREE_CODE (TYPE_MIN_VALUE (itype)) != INTEGER_CST)
+  if (!shared
+      || (TYPE_MIN_VALUE (itype)
+	  && TREE_CODE (TYPE_MIN_VALUE (itype)) != INTEGER_CST)
       || (TYPE_MAX_VALUE (itype)
 	  && TREE_CODE (TYPE_MAX_VALUE (itype)) != INTEGER_CST))
-    {
-      /* Since we cannot reliably merge this type, we need to compare it using
-	 structural equality checks.  */
-      SET_TYPE_STRUCTURAL_EQUALITY (itype);
-      return itype;
-    }
+    return itype;
 
-  if (shared)
-    {
-      hashval_t hash = iterative_hash_expr (TYPE_MIN_VALUE (itype), 0);
-      hash = iterative_hash_expr (TYPE_MAX_VALUE (itype), hash);
-      hash = iterative_hash_hashval_t (TYPE_HASH (type), hash);
-      itype = type_hash_canon (hash, itype);
-    }
+  hashcode = iterative_hash_expr (TYPE_MIN_VALUE (itype), hashcode);
+  hashcode = iterative_hash_expr (TYPE_MAX_VALUE (itype), hashcode);
+  hashcode = iterative_hash_hashval_t (TYPE_HASH (type), hashcode);
+  itype = type_hash_canon (hashcode, itype);
 
   return itype;
 }
@@ -7250,16 +7244,11 @@ build_array_type_1 (tree elt_type, tree
 
   if (TYPE_CANONICAL (t) == t)
     {
-      if (TYPE_STRUCTURAL_EQUALITY_P (elt_type)
-	  || (index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type)))
+      if (TYPE_STRUCTURAL_EQUALITY_P (elt_type))
 	SET_TYPE_STRUCTURAL_EQUALITY (t);
-      else if (TYPE_CANONICAL (elt_type) != elt_type
-	       || (index_type && TYPE_CANONICAL (index_type) != index_type))
+      else if (TYPE_CANONICAL (elt_type) != elt_type)
 	TYPE_CANONICAL (t)
-	  = build_array_type_1 (TYPE_CANONICAL (elt_type),
-				index_type
-				? TYPE_CANONICAL (index_type) : NULL_TREE,
-				shared);
+	  = build_array_type_1 (TYPE_CANONICAL (elt_type), index_type, shared);
     }
 
   return t;

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