(j3.2006) Disassociated array pointer actual argument corresponding to an optional argument of elemental procedure.

Bill Long longb
Tue Dec 9 19:36:00 EST 2014


On Dec 8, 2014, at 3:05 PM, Malcolm Cohen <malcolm at nag-j.co.jp> wrote:

> 
> 
> Bill suggests:
>> The call should have the same effect as
>> 
>>  call sub1 (arg2 = k)
>> 
>> which is valid and results in a scalar call, since all of the actual arguments 
>> are scalar.
> 
> This is completely without merit, since whether P1 is declared "INTEGER,POINTER" 
> or "INTEGER,OPTIONAL" makes no difference to the way that optionality works. 
> I.e. that argument applies precisely to the exact case that item (6) prohibits!

Certainly it is undesirable for the above to be a valid alternative, but absent a restriction otherwise it is the logical consequence of the idea that the new forms of an actual argument being not present should be semantically the same as  the actual argument being textually absent. 

I agree with Daniel?s observation that modifying (6) directly is the wrong context.  We?re talking about a restriction on disassociated pointers, not on optional arguments not present.  The analog of (1) in the same paragraph, except for disassociated pointers, is in 2.4.8p2.  However, I think it would be more relevant to have the restriction in  12.5.2.12. Perhaps a new paragraph 5 for that subclause what says directly what we want:

"A disassociated array pointer shall not be supplied as an actual argument to an elemental procedure unless an
array of the same rank is supplied as an actual argument corresponding to a nonoptional dummy
argument of that elemental procedure."

Cheers,
Bill



> 
> We prohibit that case for good reason, and one of those good reasons is that 
> allowing it would make it trivial to construct a generic reference that could 
> not be resolved at compile-time (because the rank of a function reference would 
> depend on whether a pointer was associated).  Thus violating one of the 
> fundamental principles of generic resolution.
> 
> Cheers,
> -- 
> ................................Malcolm Cohen, Nihon NAG, Tokyo. 
> 
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101





More information about the J3 mailing list