Hi,
this patch fixes ICE in ctor_for_folding where varpool_remove_node incorrectly 
clobbers
DECL_INITIAL of a variable while removing cgraph during the early LTO merging.
This case is special by alowing multiple symtab nodes for a given declaration
and we have similar special case in the other removal hooks.

I did not manage to get reliable testcase for a testsuite, but it is ICE on 
valid, too.

Bootstrapped/regtested x86_64-linux, comitted to mainline.
Jakub/Richi, OK for trunk?
        PR lto/60820
        * varpool.c (varpool_remove_node): Do not alter decls when streaming.
Index: varpool.c
===================================================================
--- varpool.c   (revision 209386)
+++ varpool.c   (working copy)
@@ -166,7 +166,9 @@ varpool_remove_node (varpool_node *node)
   /* Because we remove references from external functions before final 
compilation,
      we may end up removing useful constructors.
      FIXME: We probably want to trace boundaries better.  */
-  if ((init = ctor_for_folding (node->decl)) == error_mark_node)
+  if (cgraph_state == CGRAPH_LTO_STREAMING)
+    ;
+  else if ((init = ctor_for_folding (node->decl)) == error_mark_node)
     varpool_remove_initializer (node);
   else
     DECL_INITIAL (node->decl) = init;

Reply via email to