https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61012
--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> --- It is LTO-symtab bug. In this case we have chain with static var and external decl and we find no prevailing symbol (correctly), but then instead of choosing the external decl for further merging we go with static var as the loop forgets to skip statics. I am testing: Index: lto-symtab.c =================================================================== --- lto-symtab.c (revision 210672) +++ lto-symtab.c (working copy) @@ -453,7 +453,10 @@ 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; /* For variables chose with a priority variant with vnode attached (i.e. from unit where external declaration of variable is actually used).