tree.c (make_vector_type): Properly compute canonical type of the main variant.
authorJan Hubicka <hubicka@ucw.cz>
Tue, 24 Nov 2015 20:26:48 +0000 (21:26 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 24 Nov 2015 20:26:48 +0000 (20:26 +0000)
* tree.c (make_vector_type): Properly compute canonical type of the
main variant.
(verify_type): Verify that TYPE_CANONICAL of TYPE_MAIN_VARIANT is
a main variant.

From-SVN: r230837

gcc/ChangeLog
gcc/tree.c

index 38f71164f555fb343a2d618a1ae40b6879d504bd..8744fd733137d2940baaa4ebbc23706de1b25308 100644 (file)
@@ -1,3 +1,10 @@
+2015-11-24  Jan Hubicka  <hubicka@ucw.cz>
+
+       * tree.c (make_vector_type): Properly compute canonical type of the
+       main variant.
+       (verify_type): Verify that TYPE_CANONICAL of TYPE_MAIN_VARIANT is
+       a main variant.
+
 2015-11-24  Nathan Sidwell  <nathan@acm.org>
 
        * config/nvptx/nvptx.c (maybe_split_mode): Return new mode or
index 4176d614a51d308eb7238e02820923db9ac79275..f68a824c6a42d161546d9c802249b1c7953f91c1 100644 (file)
@@ -9860,19 +9860,20 @@ make_vector_type (tree innertype, int nunits, machine_mode mode)
 {
   tree t;
   inchash::hash hstate;
+  tree mv_innertype = TYPE_MAIN_VARIANT (innertype);
 
   t = make_node (VECTOR_TYPE);
-  TREE_TYPE (t) = TYPE_MAIN_VARIANT (innertype);
+  TREE_TYPE (t) = mv_innertype;
   SET_TYPE_VECTOR_SUBPARTS (t, nunits);
   SET_TYPE_MODE (t, mode);
 
-  if (TYPE_STRUCTURAL_EQUALITY_P (innertype) || in_lto_p)
+  if (TYPE_STRUCTURAL_EQUALITY_P (mv_innertype) || in_lto_p)
     SET_TYPE_STRUCTURAL_EQUALITY (t);
-  else if ((TYPE_CANONICAL (innertype) != innertype
+  else if ((TYPE_CANONICAL (mv_innertype) != innertype
            || mode != VOIDmode)
           && !VECTOR_BOOLEAN_TYPE_P (t))
     TYPE_CANONICAL (t)
-      = make_vector_type (TYPE_CANONICAL (innertype), nunits, VOIDmode);
+      = make_vector_type (TYPE_CANONICAL (mv_innertype), nunits, VOIDmode);
 
   layout_type (t);
 
@@ -13540,6 +13541,13 @@ verify_type (const_tree t)
       debug_tree (ct);
       error_found = true;
     }
+  if (TYPE_MAIN_VARIANT (t) == t && ct && TYPE_MAIN_VARIANT (ct) != ct)
+   {
+      error ("TYPE_CANONICAL of main variant is not main variant");
+      debug_tree (ct);
+      debug_tree (TYPE_MAIN_VARIANT (ct));
+      error_found = true;
+   }
 
 
   /* Check various uses of TYPE_MINVAL.  */