The changes suggested by:
http://gcc.gnu.org/ml/fortran/2013-05/msg00057.html
have been made in the below diff and test file.
Could someone please commit this ?
It has been approved, see the above referenced message.
thanks,
Bud Davis
Index: gcc/gcc/fortran/resolve.c
===================================================================
--- gcc/gcc/fortran/resolve.c (revision 199330)
+++ 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 }
! pr50405
! submitted by [email protected]
!{ dg-prune-output "Obsolescent feature: Statement function at" }
f(f) = 0 ! { dg-error "Self referential argument" }
end
2013-05-26 Bud Davis <[email protected]>
PR fortran/50405
resolve.c (resolve_formal_arglist): Detect error when an argument
has the same name as the function.