> On Mar 7, 2018, at 1:18 PM, Anton Shterenlikht <[log in to unmask]> wrote:
>
> Is this pure function conforming?
>
> integer pure function f( space, coord )
> integer, allocatable, intent(in) :: space(:,:,:) [:,:,:]
> integer, intent(in) :: coord(3)
> f = space( coord(1), coord(2), coord(3) )
> end function f
>
> I cannot see a prohibition against
> coarray dummy arguments in 15.7 Pure procedures.
Looks OK to me. The potential problem with a coarray in a pure procedure arises if you define the corresponding coarray on a different image. However, that case is explicitly disallowed for a pure procedure:
“C1593 In a pure subprogram any designator with a base object that … is a coindexed object … shall not be used … in a variable definition context (19.6.7)…”
Cheers,
Bill
>
> 2 compilers accept this without warning, but the third
> rejects with this error:
>
> Pure or elemental subprogram "F" must not contain "SPACE",
> which is a coarray variable or intrinsic.
>
> Yes for elemental:
> "C1599 All dummy arguments of an elemental procedure
> shall be scalar noncoarray dummy data objects..."
> but for pure?
>
> Anton
Bill Long [log in to unmask]
Principal Engineer, Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Cray Inc./ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
|