Fix PR86139

Message ID alpine.LSU.2.20.1806141252491.5043@zhemvz.fhfr.qr
State New
Headers show
Series
  • Fix PR86139
Related show

Commit Message

Richard Biener June 14, 2018, 10:53 a.m.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to
trunk and gcc 8 branch for now.

Richard.

2018-06-14  Richard Biener  <rguenther@suse.de>

	PR middle-end/86139
	* tree-vect-generic.c (build_word_mode_vector_type): Remove
	duplicate and harmful type_hash_canon.
	* tree.c (type_hash_canon): Assert we didn't find ourselves.

Patch

Index: gcc/tree-vect-generic.c
===================================================================
--- gcc/tree-vect-generic.c	(revision 261584)
+++ gcc/tree-vect-generic.c	(working copy)
@@ -111,12 +111,8 @@  build_word_mode_vector_type (int nunits)
       return vector_last_type;
     }
 
-  /* We build a new type, but we canonicalize it nevertheless,
-     because it still saves some memory.  */
   vector_last_nunits = nunits;
-  vector_last_type = type_hash_canon (nunits,
-				      build_vector_type (vector_inner_type,
-							 nunits));
+  vector_last_type = build_vector_type (vector_inner_type, nunits);
   return vector_last_type;
 }
 
Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 261584)
+++ gcc/tree.c	(working copy)
@@ -6623,7 +6623,8 @@  type_hash_canon (unsigned int hashcode,
   if (*loc)
     {
       tree t1 = ((type_hash *) *loc)->type;
-      gcc_assert (TYPE_MAIN_VARIANT (t1) == t1);
+      gcc_assert (TYPE_MAIN_VARIANT (t1) == t1
+		  && t1 != type);
       if (TYPE_UID (type) + 1 == next_type_uid)
 	--next_type_uid;
       /* Free also min/max values and the cache for integer