[patch,fortran] PR50405 - Statement function with itself as argument SEGV's
Tobias Burnus
burnus@net-b.de
Fri May 17 07:19:00 GMT 2013
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.
More information about the Fortran
mailing list