This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: [PATCH, Fortran] PROCEDURE declarations


Janus Weil wrote:
> I'm just a little confused right now: Is an EXTERNAL procedure allowed
> to have an explicit interface? "Sure, why not" would be my spontaneous
> answer.

C508  An entity shall not be explicitly given any attribute more than
once in a scoping unit.

As an INTERFACE implies EXTERNAL, an extra EXTERNAL violates that constrain.

Sometimes, gfortran -std=gnu accepts these, while gfortran -std=f2003
rejects those, e.g.
  procedure(real) :: proc
  real :: proc

> Error: EXTERNAL attribute conflicts with SUBROUTINE attribute at (1)
>
> The question is why. If I interpret the standard correctly, already
> the INTERFACE statement implies the EXTERNAL attribute. But then the
> explicit EXTERNAL statement should basically change nothing, or
> perhaps trigger an error like "EXTERNAL attribute already specified".
>   

In principle you are right that one re-specifies EXTERNAL; but before
the external attribute could only be set by the external statement. And
the current message might also be clearer for normal users than
"EXTERNAL attribute already specified"; besides for host-associated
subroutines the message would be wrong and thus one would need an extra
case/error message.

Tobias


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