diff mbox

Fix lto-bootstrap ICE with decl merging disabled

Message ID 20151227094041.GV5527@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Dec. 27, 2015, 9:40 a.m. UTC
Hi,
this seems to be last ICE I can reproduce with decl and tree merging disabled.
ipa-visibility assumes that comdat groups are either all local or all external.
With decl merging disabled we can have external aliases of comdat symbols.
We should fix the visibility of transparent aliases, but that is done later
in the pass.

lto-bootstrapped/regtested x86_64-linux. Will commit it shortly.
	* ipa-visibility.c (function_and_variable_visibility): Do not
	dissolve comdat groups when in LTO mode.
diff mbox

Patch

Index: ipa-visibility.c
===================================================================
--- ipa-visibility.c	(revision 231961)
+++ ipa-visibility.c	(working copy)
@@ -493,8 +493,12 @@  function_and_variable_visibility (bool w
         DECL_COMDAT (node->decl) = 0;
 
       /* For external decls stop tracking same_comdat_group. It doesn't matter
-	 what comdat group they are in when they won't be emitted in this TU.  */
-      if (node->same_comdat_group && DECL_EXTERNAL (node->decl))
+	 what comdat group they are in when they won't be emitted in this TU.
+
+	 An exception is LTO where we may end up with both external
+	 and non-external declarations in the same comdat group in
+	 the case declarations was not merged.  */
+      if (node->same_comdat_group && DECL_EXTERNAL (node->decl) && !in_lto_p)
 	{
 	  if (flag_checking)
 	    {