https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69824
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Just to illustrate where the bug IMNSHO is: --- c-decl.c.jj 2016-02-24 23:00:16.000000000 +0100 +++ c-decl.c 2016-03-01 08:28:07.297645914 +0100 @@ -8548,6 +8548,8 @@ store_parm_decls_newstyle (tree fndecl, /* Now make all the ancillary declarations visible, likewise. */ for (decl = arg_info->others; decl; decl = DECL_CHAIN (decl)) { + if (C_DECL_IMPLICIT (decl)) + continue; DECL_CONTEXT (decl) = current_function_decl; if (DECL_NAME (decl)) bind (DECL_NAME (decl), decl, current_scope, IMHO the problem is that the implicitly declared FUNCTION_DECL can appear in arg_info->others chain, and if they do, we certainly shouldn't change their DECL_CONTEXT to current_function_decl. What to do with them is less clear, probably treat them more similarly to when the implicit declarations appear in block scope. Whether that means copy_node and or just ignoring them, dunno.