------- Comment #6 from janus at gcc dot gnu dot org 2009-07-14 13:50 ------- The error goes away with the following patch:
Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 149623) +++ gcc/fortran/resolve.c (working copy) @@ -9845,20 +9845,6 @@ resolve_symbol (gfc_symbol *sym) if (sym->formal_ns && sym->formal_ns != gfc_current_ns) gfc_resolve (sym->formal_ns); - /* Make sure the formal namespace is present. */ - if (sym->formal && !sym->formal_ns) - { - gfc_formal_arglist *formal = sym->formal; - while (formal && !formal->sym) - formal = formal->next; - - if (formal) - { - sym->formal_ns = formal->sym->ns; - sym->formal_ns->refs++; - } - } - /* Check threadprivate restrictions. */ if (sym->attr.threadprivate && !sym->attr.save && !sym->ns->save_all && (!sym->attr.in_common However, I don't quite see the connection yet. Also, this will regress e.g. on proc_ptr_22.f90 (which is the reason why I added this hunk for PR40646). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40743