To: J3 J3/24-145 From: John Reid & Reinhold Bader Subject: Interp. on allocation segments Date: 2024-June-24 References: 24-007 -------------------------------------------------------------------- NUMBER: F23/xxx TITLE: Segments associated with allocation KEYWORDS: segment, allocate, coarray DEFECT TYPE: Clarification STATUS: J3 consideration in progress QUESTION: Is it possible for a coarray to be allocated on an image in the current team without there being a corresponding allocated coarray on another active image in the current team? For example, consider the program PROGRAM ALLOCATION IMPLICIT NONE INTEGER :: I REAL, ALLOCATABLE :: A[:] ALLOCATE (A[*]) A = THIS_IMAGE() SYNC ALL DO I = 2,THIS_IMAGE() IF (A[I]/=I) WRITE(*,*) "Value incorrect on image", I END DO DEALLOCATE (A) END Is it possible that an execution of the IF statement fails because the coarray A has already been deallocated on image I? ANSWER: Unfortunately, the standard says nothing about the ordering of the execution of an ALLOCATE or DEALLOCATE statement on an image with respect to the execution of the segment that precedes the corresponding statement on another image. The means that it is possible for a coarray to be allocated on an image in the current team without there being a corresponding allocated coarray on another active image in the current team. Also, it is possible for the example to fail. This was not intended and edits are provided to correct this. EDITS to 24-007 [149:1] In "9.7.1.2 Execution of an ALLOCATE statement", para 5, after sentence 3 "If no other error condition ... this team." add "Execution of the statement on an image shall be delayed until the segment preceding the same statement has been executed on all active images in the current team." [152:10] In "9.7.3.2 Deallocation of allocatable variables", after sentence 3 "If no other error condition ... this team." add "Execution of the statement on an image shall be delayed until the segment preceding the same statement has been executed on all active images in the current team."