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

Van Snyder Van.Snyder
Mon Dec 8 15:38:25 EST 2014


On Mon, 2014-12-08 at 15:12 -0500, Daniel C Chen wrote:

> Hello,
> 
> Is the following program standard conforming?
> 
>         
>               integer, pointer :: p1(:)
>               integer k
>         
>               nullify(p1)
>         
>               call sub1(p1, k)
>         
>               contains
>               impure elemental subroutine sub1(arg1, arg2)
>                 integer,  intent(inout), optional :: arg1
>                 integer,  intent(in) :: arg2
>               end subroutine
>               End
> 
> P1 is disassocated, but its extent is used to scalarize the elemental
> procedure call. Is this code standard conforming?
> 
> The only thing I found that is sort of relevant in the standard is
> [12.5.2.12: p3: (6)]
> 
> "An optional dummy argument that is not present is subject to the
> following restrictions.
> ...
> (6) If it is an array, it 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."
> 
> Do we need something similar to this for the test case at the above?


I don't think we need something extra for this case, but item (6) ought
to be reworded to start with the absent dummy argument, and then work
backward to the actual arguments.  Something like "(6) If it is an array
and the procedure is an elemental procedure, there shall be an array
actual argument of the same rank that corresponds to a nonoptional dummy
argument of that elemental procedure."


> 
> Thanks,
> 
> Daniel
> 
> XL Fortran Development - IBM Toronto Software Lab
> Phone: 905-413-3056   
> Tie: 969-3056   
> Email: cdchen at ca.ibm.com
> http://www.ibm.com/software/awdtools/fortran/xlfortran
> 
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20141208/6a878d1a/attachment.html 



More information about the J3 mailing list