ISO/IEC JTC1/SC22/WG5 N1752 Draft response to N1745 (VOLATILE coarrays) John Reid The primary purpose of allowing coarrays to be volatile is to support the spin loop, illustrated in NOTE 8.38 of N1723 (the currect draft for the next Fortran standard). The presence of the spin loop allows the programmer to construct needed synchronizations that are not provided directly in the language. On behalf of the UK, Nick Maclaren points out that programmers are likely to use volatile coarrays in other ways and will get results that they did not expect. Futhermore, these unexpected results may occur quite infrequently, leading to failures of programs that were thought to be tested. I am convinced by these arguments. The US proposes that locks should be added to the draft (see J3/08-256r2), to provide an efficient mechanism for programmers to avoid race conditions when they require data to be altered by more than one executing image. This is an example of a synchronization that could be coded with the help of a volatile coarray, but I agree that it is of sufficient importance to justify its inclusion as an intrinsic feature. It is my belief that this feature provides an adequate replacement for the volatile coarray to support the spin loop. For example, the code in NOTE 8.38 of N1723: LOGICAL,VOLATILE :: LOCKED[*] = .TRUE. INTEGER :: IAM, P, Q IAM = THIS_IMAGE() IF (IAM == P) THEN ! Preceding segment SYNC MEMORY ! A LOCKED[Q] = .FALSE. ! segment Pi SYNC MEMORY ! B ELSE IF (IAM == Q) THEN DO WHILE (LOCKED); END DO ! segment Qj SYNC MEMORY ! C ! Subsequent segment END IF may be replaced by USE, INTRINSIC :: ISO_FORTRAN_ENV TYPE (LOCK_TYPE) :: SpinLock[*] INTEGER :: IAM, P, Q LOCK(SpinLock) ! Initialize to LOCKED : IAM = THIS_IMAGE() IF (IAM == P) THEN ! Preceding segment UNLOCK(SpinLock[Q]) ELSE IF (IAM == Q) THEN LOCK (SpinLock) ! The image spins here ! Subsequent segment END IF I see the replacement as much clearer. For these reasons, I suggest to WG5 that coarrays should not be permitted to have the VOLATILE attribute and that the feature for locks proposed by the US be added.