This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch,fortran] PR50405 - Statement function with itself as argument SEGV's
- From: Tobias Burnus <burnus at net-b dot de>
- To: Bud Davis <bdavis9659 at sbcglobal dot net>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 17 May 2013 09:19:49 +0200
- Subject: Re: [patch,fortran] PR50405 - Statement function with itself as argument SEGV's
- References: <1368760968 dot 56247 dot YahooMailClassic at web182202 dot mail dot bf1 dot yahoo dot com>
Am 17.05.2013 05:22, schrieb Bud Davis:
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)
Missing blank after the comma.
+ {
+ gfc_error ("Self referential argument "
+ "'%s' at %L is not allowed", sym->name,
+ &proc->declared_at);
+ return;
Indentation is wrong. (As a friend of hyphens, I would add one between
self and referential, but it is also fine without.)
!{ dg-do compile }
! submitted by zeccav@gmail.com
!{ dg-prune-output "Obsolescent feature: Statement function at" }
Please add "! PR fortran/50405" as comment.
Instead of dg-prune-output, you could also use: '! { dg-options "" }'.
That will override the default setting, i.e. it removes the "-pedantic".
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.
OK and thanks for the patch!
Tobias
PS: Nice that you are back to (casual) gfortran development.