[PATCH, Fortran] PROCEDURE declarations

Janus Weil jaydub66@googlemail.com
Mon Sep 3 13:56:00 GMT 2007


Hi,

> > On this matter it says:
> > "A procedure declaration statement declares procedure pointers, dummy
> > procedures, and external procedures. It specifies the EXTERNAL
> > attribute (5.1.2.6) for all procedure entities in the proc-decl
> > -list."
> > So the test case is surely illegal.
>
> Hm, so instead of doing all these checks and finding all possible
> conflicts, it should be sufficient to call gfc_add_external().

Yeah, I actually do that in gfc_match_procedure_decl. And yes, this
should already catch the most common conflicts.
But in the case of ENTRY that wasn't enough. Without my patch, a
conflict between ENTRY and EXTERNAL would be caught by:

  if (attr->if_source || attr->contained)
    {
      conf (external, subroutine);
      conf (external, function);
    }

But this check was a problem for PROCEDUREs, since they can have an
explicit interface. In this code:

abstract interface
  subroutine abssub()
  end subrouine
end interface
procedure(abssub)::p

the symbol p would have the attributes PROCEDURE, EXTERNAL, SUBROUTINE
and also attr->if_source=IFSRC_DECL, since it has an explicit
interface. So the above check would give an error. Therefore I changed
the if-clause to:

if ((attr->if_source && !attr->procedure) || attr->contained)

That does prevent the falsely issued error for "p".
*But* it also makes useless the conflict-check for ENTRY and
PROCEDURE, which then has to be done manually by "conf (procedure,
entry)".
I hope my way to deal with this stuff is ok and there is no logical
error in my thinking.

Cheers,
Janus



More information about the Gcc-patches mailing list