This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] restrictions on recursive procedures
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: François-Xavier Coudert <fxcoudert at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, GFortran <fortran at gcc dot gnu dot org>
- Date: Wed, 10 May 2006 23:20:20 +0200
- Subject: Re: [gfortran] restrictions on recursive procedures
- References: <19c433eb0605070405s4f253ff8ldb759662b160ca30@mail.gmail.com>
François-Xavier,
I missed the fact that this is a patch; it has neither "patch" in the
title nor a PR. The only reason that I found it was that I had the PR
marked to do myself!
I just applied it to my tree and will do the regtesting, whilst in the
land of Nod. From a very quick look, it seemed OK. I would suggest
revamping it slightly(untested!), as follows:
if (expr->value.function.esym &&
!expr->value.function.esym->attr.recursive)
{
gfc_symbol *esym, *proc;
esym = expr->value.function.esym;
proc = gfc_current_ns->proc_name;
if (esym == proc)
{
gfc_error ("Function '%s' at %L cannot call itself, as it is not "
"RECURSIVE", name, &expr->where);
t = FAILURE;
}
if (esym->attr.entry
&& esym->ns->entries
&& proc->ns->entries
&& esym->ns->entries->sym == proc->ns->entries->sym)
{
gfc_error ("Call to ENTRY '%s' at %L is recursive, but function "
"'%s' is not declared as RECURSIVE",
esym->name, &expr->where,
esym->ns->entries->sym->name);
t = FAILURE;
}
}
+ ibid for the subroutines. You need to cycle through the entries in the
second block do you not?
Anyway, I will review it properly tomorrow and will come back to you then.
Paul