diff mbox

Fix PR62077

Message ID alpine.LSU.2.11.1408131428020.20733@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Aug. 13, 2014, 12:30 p.m. UTC
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.
diff mbox

Patch

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