This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch,fortran] PR50405 - Statement function with itself as argument SEGV's
- From: Bud Davis <bdavis9659 at sbcglobal dot net>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 May 2013 20:22:48 -0700 (PDT)
- Subject: [patch,fortran] PR50405 - Statement function with itself as argument SEGV's
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 zeccav@gmail.com
!{ dg-prune-output "Obsolescent feature: Statement function at" }
f(f) = 0 ! { dg-error "Self referential argument" }
end
2013-05-17 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.