(j3.2006) ASSOCIATED

Robert Corbett Robert.Corbett at Sun.COM
Fri Mar 12 01:17:02 EST 2010


Van Snyder wrote:
> On Tue Mar 9 17:31:59 EST 2010 Robert Corbett Robert.Corbett at Sun.COM
> wrote:
> 
>         In the description of the intrinsic function ASSOCIATED
>         [13.7.13, 304-305], the word absent clearly means omitted.
> 
> ASSOCIATED works just fine if "absent" means "not present" in the sense
> defined by ordinary English usage and subclause 12.5.2.12 because TARGET
> is not defined to be a pointer dummy argument.  To me, that that means
> it's not a pointer dummy argument.  Since it's optional, if its
> associated actual argument is disassociated, that means the dummy
> argument is not present, and the rest of the description works.  This
> didn't work in F90, F95 or F03.
> 
> There is a bit of redundancy because if TARGET is a disassociated
> pointer, Cases (vi) and (vii) can't occur.  But that's not really a
> problem.
> 
> I thought we at one time specified 13.2.1 that the descriptions of
> arguments of intrinsic functions describe requirements on the actual
> arguments, rather than describing the dummy arguments -- but I can't
> find it now.  If we do say this somewhere, we need to take extra care
> with ASSOCIATED to say that its POINTER argument is a POINTER dummy
> argument; otherwise we have to add that its pointer association status
> can be disassociated, to avoid the requirement that pointers associated
> with nonpointer nonoptional dummy arguments have to be associated with a
> target.
> 
> ALLOCATED has similar problems, mutatis mutandis.

I see now that fixing the specifications of the intrinsic functions is
going to be a lot of fun.

I do not think that the authors of the standard intended it to be
impossible for cases (vi) or (vii) to occur.  Under your interpretation,
the program

       PROGRAM MAIN
         POINTER P, Q
         REAL X
         TARGET X
         P => X
         NULLIFY(Q)
         PRINT *, ASSOCIATED(P, Q)
       END

should print " T" because P is associated and Q, which is argument
associated with the dummy argument TARGET of ASSOCIATED, is not
associated and therefore the dummy argument TARGET is "not present."
I just compiled and ran that program using three different compilers.
All three runs printed " F".

Bob Corbett


More information about the J3 mailing list