diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 7c93cb7d6a0..dedabf36867 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2014-05-17 Jan Hubicka + + PR lto/61012 + * lto-symtab.c (lto_symtab_merge_decls_1): Do not ICE on undefined externals + mixed with variables. + 2014-05-17 Trevor Saunders * lto-tree.h: Don't use variable_size gty attribute. diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c index 5486e737f76..957261ec8b7 100644 --- a/gcc/lto/lto-symtab.c +++ b/gcc/lto/lto-symtab.c @@ -447,7 +447,12 @@ lto_symtab_merge_decls_1 (symtab_node *first) 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).