Am 26.05.2013 05:58, schrieb Bud Davis:
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 ?
I thought you have commit rights?
Note: You added a hyphen to the error message without changing the
dg-error pattern. Additionally, it would help if you could also create a
changelog for the testsuite - also a "*" was missing before the file
name in the ChangeLog. And finally, I am not sure whether "!{ dg-do
compile }" works - it might be that DejaGNU requires a space before the "{".
Committed as Rev. 199358 (with minor modifications). Thanks for the
patch - and welcome back to contributing to gfortran :-)
Tobias
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 199357)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,9 @@
+2013-05-27 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.
+
2013-05-27 Tobias Burnus <bur...@net-b.de>
* expr.c (gfc_build_intrinsic_call): Make symbol as attr.artificial.
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (Revision 199357)
+++ gcc/fortran/resolve.c (Arbeitskopie)
@@ -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);
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 199357)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2013-05-27 Bud Davis <jmda...@link.com>
+
+ PR fortran/50405
+ * gfortran.dg/stfunc_8.f90: New.
+
2013-05-27 Richard Biener <rguent...@suse.de>
PR tree-optimization/57343
Index: gcc/testsuite/gfortran.dg/stfunc_8.f90
===================================================================
--- gcc/testsuite/gfortran.dg/stfunc_8.f90 (Revision 0)
+++ gcc/testsuite/gfortran.dg/stfunc_8.f90 (Arbeitskopie)
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "" }
+!
+! PR fortran/50405
+!
+! Submitted by zec...@gmail.com
+!
+ f(f) = 0 ! { dg-error "Self-referential argument" }
+ end