Hi,
this patch fixes an ICE on undefined symbol. The testcase does not really go 
easily to testsuite
because it needs the undefined symbols to trigger. THe bug is however clear - 
one of the
loops is not properly skipping the static symbols.

Bootstrapped/regtested x86_64-linux, comitted to mainline and branch.
Honza

        PR lto/61012
        * lto-symtab.c (lto_symtab_merge_decls_1): Do not ICE on undefined 
externals
        mixed with variables.
Index: lto-symtab.c
===================================================================
--- lto-symtab.c        (revision 210672)
+++ lto-symtab.c        (working copy)
@@ -453,7 +453,12 @@ lto_symtab_merge_decls_1 (symtab_node *f
      cgraph or a varpool node.  */
   if (!prevailing)
     {
-      prevailing = first;
+      for (prevailing = first;
+          prevailing; prevailing = prevailing->next_sharing_asm_name)
+       if (lto_symtab_symbol_p (prevailing))
+         break;
+      if (!prevailing)
+       return;
       /* For variables chose with a priority variant with vnode
         attached (i.e. from unit where external declaration of
         variable is actually used).

Reply via email to