https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65380
--- Comment #10 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Actually perhaps we manage to produce external alias of non-external symbol that also should not happen. Index: ipa-icf.c =================================================================== --- ipa-icf.c (revision 221461) +++ ipa-icf.c (working copy) @@ -809,6 +809,15 @@ sem_function::merge (sem_item *alias_ite bool original_address_matters = original->address_matters_p (); bool alias_address_matters = alias->address_matters_p (); + if (DECL_EXTERNAL (alias->decl)) + { + if (dump_file) + fprintf (dump_file, + "Not unifying; " + "alias is external.\n\n"); + return false; + } + if (DECL_NO_INLINE_WARNING_P (original->decl) != DECL_NO_INLINE_WARNING_P (alias->decl)) { @@ -1767,6 +1870,14 @@ sem_variable::merge (sem_item *alias_ite "Symbol aliases are not supported by target\n\n"); return false; } + if (DECL_EXTERNAL (alias->decl)) + { + if (dump_file) + fprintf (dump_file, + "Not unifying; " + "alias is external.\n\n"); + return false; + } sem_variable *alias_var = static_cast<sem_variable *> (alias_item); May help.