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 PR62077


The following fixes the LTO bootstrap miscompares on the branches.
They happen because type_hash_canon can end up returning different
types (a main variant or a variant type) dependent on whether
we garbage collected before or not.

The patch makes us never return a variant type from type_hash_canon
if we fed it a main variant (and vice versa).

LTO bootstrap running on the 4.9 branch, regular bootstrap and testing
running on x86_64-unknown-linux-gnu.

Richard.

2014-08-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/62077
	* tree.c (type_hash_eq): Do not treat main variants equal
	to non-main-variants.

Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 213814)
+++ gcc/tree.c	(working copy)
@@ -6593,7 +6593,9 @@ type_hash_eq (const void *va, const void
       || !attribute_list_equal (TYPE_ATTRIBUTES (a->type),
 				 TYPE_ATTRIBUTES (b->type))
       || (TREE_CODE (a->type) != COMPLEX_TYPE
-          && TYPE_NAME (a->type) != TYPE_NAME (b->type)))
+          && TYPE_NAME (a->type) != TYPE_NAME (b->type))
+      || ((TYPE_MAIN_VARIANT (a->type) == TYPE_MAIN_VARIANT (a->type))
+	  != (TYPE_MAIN_VARIANT (b->type) == TYPE_MAIN_VARIANT (b->type))))
     return 0;
 
   /* Be careful about comparing arrays before and after the element type


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