https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104669
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- These push_local_extern_decl_alias created aliases are an endless source of problems :(. What happens is we create foo as a FUNCTION_DECL local to the function, then push_local_extern_decl_alias creates another FUNCTION_DECL for it. Then duplicate_decls is called on the local decl and another new local decl, during that duplicate_decls e.g. DECL_ATTRIBUTES and other flags on the local FUNCTION_DECL are tweaked, but doesn't update DECL_ATTRIBUTES etc. on the extern alias. The only spot in duplicate_decls that deals with this is: if (VAR_OR_FUNCTION_DECL_P (newdecl) && DECL_LOCAL_DECL_P (newdecl)) { if (!DECL_LOCAL_DECL_P (olddecl)) /* This can happen if olddecl was brought in from the enclosing namespace via a using-decl. The new decl is then not a block-scope extern at all. */ DECL_LOCAL_DECL_P (newdecl) = false; else { retrofit_lang_decl (newdecl); DECL_LOCAL_DECL_ALIAS (newdecl) = DECL_LOCAL_DECL_ALIAS (olddecl); } } So, how do we synchronize changes from the local FUNCTION_DECL to DECL_LOCAL_DECL_ALIAS when they are made?