(j3.2006) allocatable and pointer actual arguments to intrinsicfunctions

Robert Corbett Robert.Corbett at Sun.COM
Tue Mar 9 17:31:59 EST 2010


Malcolm Cohen wrote:

> "An allocatable variable with [unallocated] status shall not be referenced"
> 
> Similarly pointer.
> 
> Cheers,

I must not have explained the problem well enough.  Consider the
following function:

       LOGICAL FUNCTION F(A, P)
         LOGICAL A{:}
         INTEGER P
         POINTER P
         F = ALL(A, P)
       END

The dummy argument P of F is not an optional dummy argument and
so is allowed to be argument associated with the optional dummy
argument DIM of the intrinsic reduction function ALL.  In
Fortran 2003, the dummy argument DIM of ALL is considered to be
present, regardless of whether P is associated, and so the
statement you cited applies.  In 09-007r3, if P in F is not
associated, the dummy argument DIM of ALL is considered not to
be present.  The question is when 09-007r3, Section 13.7.8
[302:24] states

      It is scalar if DIM is absent

does the word "absent" mean "not present" or does it mean
"omitted?"  If it means not present, then the function F is
conformant even if P is unassociated, as it will not reference
P  If it means omitted, then the statement you cited still
applies and so F is not conformant.

The descriptions of the intrinsic procedures appear to use the
word "absent" inconsistently.  In the description of the
intrinsic function ASSOCIATED [13.7.13, 304-305], the word
absent clearly means omitted.  In the description of the
intrinsic function INDEX [13.7.52, 322-323], if the word
absent means omitted, there is a missing case for the result
value.

Robert Corbett


More information about the J3 mailing list