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]

Fix xalancbmk LTO/WHOR ICE


Hi,
with the varpool dumping I broke xalancbmk on LTO (it never worked with WHOPR).
The problem is that decl merging attempts to replace variable with a varpool node
with variable without.

I must admit this is not area I would feed confident in.  
The patch makes lto_symtab_resolve_can_prevail_p to choose only variables with defnition
of body in it and I removed dubious looking logic in lto_symtab_merge_decls_1.

vnode->inalized imply that the decl is not just forward declaration.  But I guess
we can have one with has initializer merged with one without?
So perhaps the second hunk still makes sense? (we just need to remove the comment
about not streming varpool node)

	* lto-symtab.c (lto_symtab_resolve_can_prevail_p): Preffer variables with nodes.
	(lto_symtab_merge_decls_1): Remove logic chosing preferred variable.

Index: lto-symtab.c
===================================================================
--- lto-symtab.c	(revision 158936)
+++ lto-symtab.c	(working copy)
@@ -406,11 +406,7 @@ lto_symtab_resolve_can_prevail_p (lto_sy
 
   /* A variable should have a size.  */
   else if (TREE_CODE (e->decl) == VAR_DECL)
-    return (DECL_SIZE (e->decl) != NULL_TREE
-	    /* The C++ frontend retains TREE_STATIC on the declaration
-	       of foo_ in struct Foo { static Foo *foo_; }; but it is
-	       not a definition.  g++.dg/lto/20090315_0.C.  */
-	    && !DECL_EXTERNAL (e->decl));
+    return (e->vnode && e->vnode->finalized);
 
   gcc_unreachable ();
 }
@@ -588,17 +584,6 @@ lto_symtab_merge_decls_1 (void **slot, v
 	while (!prevailing->vnode
 	       && prevailing->next)
 	  prevailing = prevailing->next;
-      /* We do not stream varpool nodes, so the first decl has to
-	 be good enough for now.
-	 ???  For QOI choose a variable with readonly initializer
-	 if there is one.  This matches C++
-	 struct Foo { static const int i = 1; }; without a real
-	 definition.  */
-      if (TREE_CODE (prevailing->decl) == VAR_DECL)
-	while (!(TREE_READONLY (prevailing->decl)
-		 && DECL_INITIAL (prevailing->decl))
-	       && prevailing->next)
-	  prevailing = prevailing->next;
     }
 
   /* Move it first in the list.  */


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