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

Daniel C Chen cdchen
Mon Dec 8 15:12:07 EST 2014




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?

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20141208/b9df1cff/attachment.html 



More information about the J3 mailing list