===================================================================
@@ -1,3 +1,9 @@
+2013-05-27 Bud Davis <jmdavis@link.com>
+
+ PR fortran/50405
+ * resolve.c (resolve_formal_arglist): Detect error when an argument
+ has the same name as the function.
+
2013-05-27 Tobias Burnus <burnus@net-b.de>
* expr.c (gfc_build_intrinsic_call): Make symbol as attr.artificial.
===================================================================
@@ -306,6 +306,14 @@ resolve_formal_arglist (gfc_symbol *proc)
&& !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);
===================================================================
@@ -1,3 +1,8 @@
+2013-05-27 Bud Davis <jmdavis@link.com>
+
+ PR fortran/50405
+ * gfortran.dg/stfunc_8.f90: New.
+
2013-05-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/57343
===================================================================
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "" }
+!
+! PR fortran/50405
+!
+! Submitted by zeccav@gmail.com
+!
+ f(f) = 0 ! { dg-error "Self-referential argument" }
+ end