This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] restrictions on recursive procedures


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]