https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89341
--- Comment #12 from JunMa <JunMa at linux dot alibaba.com> --- (In reply to Jan Hubicka from comment #11) > Removing the alias check seems correct to me. The same body alias patch was > long and needed special casing those aliases on quite few places. I am not > at all sure why I added this one, but it definitly silences the diagnostics > completely that is wrong. we cannot remove the alias check here directly, since the definition and alias field of target node is set to true in cgraph_node::create_alias. Consider: static void __attribute__((weakref("bar"))) foo1(void); static void __attribute__((weakref("foo1"))) foo2(void); void bar(); if alias check removed, gcc gives warning at foo2. I have sent the patch to maillist, see https://gcc.gnu.org/ml/gcc-patches/2019-03/msg01249.html, please have a look.