https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86905
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- extern "C" inline void foo () {} static void bar () __attribute__((__weakref__("foo"))); void baz () { bar (); } I've tried to: --- cgraph.h.jj 2018-11-09 21:16:44.792168407 +0100 +++ cgraph.h 2018-11-23 19:18:38.874777589 +0100 @@ -377,7 +377,11 @@ public: constructors. */ inline bool comdat_local_p (void) { - return (same_comdat_group && !TREE_PUBLIC (decl)); + if (!same_comdat_group || TREE_PUBLIC (decl)) + return false; + if (weakref) + return get_alias_target ()->comdat_local_p (); + return true; } /* Return true if ONE and TWO are part of the same COMDAT group. */ but it ICEs later on. Honza, can you please have a look?