There are two questions I would like an explanation for in the simple test below:
1. Why doesn't the code issue an error at run time - since the allocation of the coarray specifies different bounds on image 1 and images >1?
2. Why does the code run to completion at all? I thought there was an implicit barrier (SYNC ALL) for the allocation of any coarray, and that this barrier had to correspond to the same line of code. Or is it sufficient to have coarray allocations with the same bounds (even if said allocation occurs in different parts of the program)?
(1) looks like a bug - the Cray compiler works as intended in this case; (2) I am not so sure (actually it's better not to have the requirement of a barrier on the same ALLOCATE statement (same line of code).
Thanks,
Olivier
PROGRAM COARRAY_TEST
IMPLICIT NONE
INTEGER,ALLOCATABLE :: TEST(:)[:]
! Master thread
IF (THIS_IMAGE()==1) THEN
ALLOCATE(TEST(2)[*])
TEST = THIS_IMAGE()
! Slave threads
ELSE
ALLOCATE(TEST(4)[*])
TEST = THIS_IMAGE()
ENDIF
! Write TEST
WRITE(*,'(A,I4,A,10I4)') 'Image #',THIS_IMAGE(),' Array value:',TEST
END PROGRAM COARRAY_TEST