To: J3 J3/19-250 From: John Reid & Reuben D. Budiardja & Daniel Chen Subject: US 12, arrays of coarrays Date: 2019-October-16 Discussion ---------- This paper proposes specs, syntax, and edits for US-12, see 18-280r1. Proposed formal specifications ------------------------------ 1. Allow an object of a derived type that has a coarray ultimate component to be an array. There is a separate coarray for each element of the parent array and coarrays in separate elements are not required to have the same bounds and cobounds. 2. Allow an object of a derived type that has a coarray ultimate component to be allocatable, which implies that it is also allowed to be polymorphic. 3. In an allocate or deallocate statement for a coarray that is an ultimate component of a polymorphic variable, the variable shall have the same set of coarray components. 4. In an intrinsic assignment for a variable that has a coarray ultimate component, and must have the same type, the same type parameters, and the same shape. Proposed syntax --------------- No new syntax. Edits to 18-007r1 ----------------- [xiii] Introduction Add "A data object that has a coarray component is no longer restricted to be scalar." "A data object that has a coarray component is allowed to be allocatable." [95:26-27] In 8.5.6 CODIMENSION attribute, change C825 to "C825 An entity whose type has a coarray ultimate component shall not be a pointer, shall not be a coarray, and shall not be a function result." [132:30] In 9.7.1.1 Form of the ALLOCATE statement, delete "C937 (R927) type-spec shall not specify a type that has a coarray ultimate component." [134:17+] In 9.7.1.2 Execution of an ALLOCATE statement, at the end of para 3, add "When an ALLOCATE statement is executed for which an allocate-object is a coarray, and if the coarray is an ultimate component of an array element, it shall be the same element on all active images of the current team. When an ALLOCATE statement is executed for which an allocate-object is a coarray, and if the coarray is an ultimate component of a polymorphic variable, the variable shall have the same set of coarray components." [137:31] In 9.7.3.2 Deallocation of allocatable variables, para 10, after the first sentence, add "When a statement deallocates a coarray that is an ultimate component of an array element, it shall be the same element on all active images of the current team. When a statement deallocates a coarray that is an ultimate component of a polymorphic variable, the variable shall have the same set of coarray components." [160:1] In 10.2.1.2 Intrinsic assignment statement, para 1, item(1), change "," to " or a data object with a coarray component," so that the item becomes "(1) if the variable is polymorphic it shall be allocatable and not a coarray or a data object with a coarray component," [160:10] In 10.2.1.2 Intrinsic assignment statement, para 1, item(3), change "not a coarray" to "not a coarray or an array of objects with a coarray component" so that the item becomes "(3) the variable and expr shall be conformable unless the variable is an allocatable array that has the same rank as expr and is not a coarray or an array of objects with a coarray component," [198:14] In 11.6.1 Image control statements, para 2, replace bullet 5 o ALLOCATE or DEALLOCATE statement that has a coarray allocate-object by the two bullets o ALLOCATE statement that has a coarray allocation; o DEALLOCATE statement that has a coarray allocate-object or an allocate-object that has a coarray ultimate component; [308:25-26] In 15.5.2.8 Coarray dummy variables, para 2, add ", is an array that has the CONTIGUOUS attribute and has a coarray ultimate component," after "CONTIGUOUS attribute" and change "is not of assumed shape" to "is neither of assumed shape nor of assumed rank". This makes the para. become "If the dummy argument is an array coarray that has the CONTIGUOUS attribute, is an array that has the CONTIGUOUS attribute and has a coarray ultimate component, or is neither of assumed shape nor of assumed rank, the corresponding actual argument shall be simply contiguous or an element of a simply contiguous array."