http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53718
--- Comment #7 from janus at gcc dot gnu.org 2012-06-19 13:13:03 UTC --- (In reply to comment #6) > > Could it be revision 181505? > > Very likely. If it is, I'm betting on the PR50640 part of that commit. Indeed the following patch, which is practically a revert of the trans-decl.c part of the above commit, makes the errors go away: Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (revision 188334) +++ gcc/fortran/trans-decl.c (working copy) @@ -1483,7 +1483,6 @@ gfc_get_symbol_decl (gfc_symbol * sym) || (sym->name[0] == '_' && strncmp ("__def_init", sym->name, 10) == 0)) { TREE_READONLY (decl) = 1; - GFC_DECL_PUSH_TOPLEVEL (decl) = 1; } return decl; @@ -1913,8 +1912,7 @@ build_function_decl (gfc_symbol * sym, bool global /* Layout the function declaration and put it in the binding level of the current function. */ - if (global - || (sym->name[0] == '_' && strncmp ("__copy", sym->name, 6) == 0)) + if (global) pushdecl_top_level (fndecl); else pushdecl (fndecl);