J3/17-101 To: J3 Members From: Steve Kargl Subject: F2008 interp: Limitions on coarray by C526 and associating Date: 2016 November 02 ---------------------------------------------------------------------- NUMBER: F08/ TITLE: Limitions on coarray by C526 and associating selectors KEYWORDS: ASSOCIATE, coarray DEFECT TYPE: STATUS: J3 consideration in progress QUESTION: Consider the following code: SUBROUTINE CO_ASSOC IMPLICIT NONE INTEGER, PARAMETER :: P = 5 REAL, ALLOCATABLE :: A(:,:)[:,:] ALLOCATE (A(P,P)[2,*]) ASSOCIATE (I => A(1:P,1:P)) END ASSOCIATE END SUBROUTINE CO_ASSOC Is the associating entity 'I' in the above code considered to be a coarray? Does this conflict with Fortran 2008 C526? ANSWER: From 8.1.3.3, one has Within an ASSOCIATE or SELECT TYPE construct, each associating entity has the same rank and corank as its associated selector. ... The cobounds of each codimension of the associating entity are the same as those of the selector. From 5.3.6.1, one has The CODIMENSION attribute specifies that an entity is a coarray. The coarray-spec specifies its corank or corank and cobounds. So, the associating entity 'I' acquires corank and cobounds from the selector. Only a coarray has corank and cobounds. If 'I' is considered to be a coarray, then Fortran 2008 C526 seems to impose very limiting conditions on a coarray as an associating selector. C526 A coarray or an object with a coarray ultimate component shall be a dummy argument or have the ALLOCATABLE or SAVE attribute. From 16.5.1.6, one has If the selector is allocatable, it shall be allocated; the associate name is associated with the data object and does not have the ALLOCATABLE attribute. Inspection of the above code shows that the associating entity 'I' is not a dummy argument, does not have the ALLOCATABLE attribute via 16.5.1.6, nor the SAVE attribute. EDITS to 10-007r1: Suggested edit to C526 C526 A coarray or an object with a coarray ultimate component shall be a dummy argument or have the ALLOCATABLE or SAVE attribute or shall be an associating selector. SUBMITTED BY: HISTORY: yy-nnn mxxx F08/nnnn submitted ----------------------------------------------------------------------