(j3.2006) error in CD 1539-1

Robert Corbett Robert.Corbett
Tue Apr 22 02:32:22 EDT 2008

Malcolm Cohen wrote:
> On Sun, 20 Apr 2008 21:13:46 +0900, Robert Corbett <Robert.Corbett at sun.com> wrote:
>>Paragraph 2 of Section 5.3.9 of CD 1539-1 states
>>     If an external procedure or dummy procedure is used as
>>     an actual argument or is the target of a procedure
>>     pointer assignment, it shall be declared to have the
>>     EXTERNAL attribute.
>>Paragraph 4 of Section states
>>     If an external procedure name or a dummy procedure
>>     name is used as an actual argument, its interface
>>     shall be explicit or it shall be explicitly declared
>>     to have the EXTERNAL attribute.
>>The statement from Section 5.3.9 is clearly deficient.
> What is deficient about it?
> The words in are unnecessarily verbose, to the point
> of being possibly misleading, but they don't contradict 5.3.9.
> That is because in order to give an external/dummy an explicit
> interface you have to give it the EXTERNAL attribute, see
> F2003 [259:31] and [264:8].

I wish that were true.  It should be true.

I know of only one way for a procedure name to have an explicit
interface without it having the EXTERNAL attribute. There might
be others of which I am not aware.  In a subroutine or a function
with a separate result variable, the interface of the subroutine
or function is explicit, but it does not have the EXTERNAL
attribute.  Furthermore, as of Fortran 2003, it cannot be given
the EXTERNAL attribute, see [264:2-3].

The statement corresponding to the second statement I cited
first appeared in the Fortran 95 standard, see Fortran 95
[197:22-23].  The corresponding statement in the Fortran 90
standard was different.  I assume that the authors of the
Fortran 95 standard understood that a procedure name could
have an explicit interface without having the EXTERNAL
attribute.  I assume they did not add the bit about explicit
interface simply to pad the standard.

>>I suggest rewriting it as
> ...
>>The same defect in present in the Fortran 2003 standard,
>>but not in the Fortran 95 standard.
> Fortran 95 didn't have procedure pointers, so I don't see the relevance.

Fortran 95 did allow procedure names as actual arguments.  The defect
I pointed out concerned them, not procedure pointers.  Note that my
proposed change left the statement about targets of procedure
assignments unchanged.

> Anyway, assuming I understand the problem, the right fix is to simplify
> not to modify 5.3.9.

A further point occurred to me while I was preparing this response.
I could not find a statement to the effect that an entry-name has
an explicit interface in the scoping unit in which the ENTRY statement
for that entry-name appears.  Should there be such a statement?

Bob Corbett

More information about the J3 mailing list