Not to much to add beyond the title and the patch. The test file fails before (eventually, when you run out of stack) and passes after the patch is applied. No new testsuite failures.
--bud Index: gcc/gcc/fortran/resolve.c =================================================================== --- gcc/gcc/fortran/resolve.c (revision 198955) +++ gcc/gcc/fortran/resolve.c (working copy) @@ -306,6 +306,14 @@ && !resolve_procedure_interface (sym)) return; + if (strcmp (proc->name,sym->name) == 0) + { + gfc_error ("Self referential argument " + "'%s' at %L is not allowed", sym->name, + &proc->declared_at); + return; + } + if (sym->attr.if_source != IFSRC_UNKNOWN) resolve_formal_arglist (sym); !{ dg-do compile } ! submitted by zec...@gmail.com !{ dg-prune-output "Obsolescent feature: Statement function at" } f(f) = 0 ! { dg-error "Self referential argument" } end 2013-05-17 Bud Davis <jmda...@link.com> PR fortran/50405 resolve.c (resolve_formal_arglist): Detect error when an argument has the same name as the function.