diff mbox

PR lto/61012 (ICE on undefined symbol)

Message ID 20140522053954.GA13402@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka May 22, 2014, 5:39 a.m. UTC
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.
diff mbox

Patch

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).