https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89341
--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Both decls of "foo" are using the same FUNCTION_DECL. node->alias is set in varasm.c: assemble_alias here: 5991 cgraph_node::get_create (decl)->alias = true; when processing the second decl of "foo" here: void foo (); since the FUNCTION_DECL for "foo" has an "alias" attribute, given to it by handle_weakref_attribute when parsing the first decl of here: __attribute__((weakref("bar"))) static void foo () { }