https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85510
Bug ID: 85510 Summary: Linking error when accessing a coindexed variable inside an associate block Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: damian at sourceryinstitute dot org Target Milestone: --- The code below compiles without error with -fcoarray=single; whereas compiling with -fcoarray=lib generates the link-time error message shown with the gfortran 7.2.0 and with the trunk dated 20180412. The gfortran command comes from the output of the OpenCoarrays command 'caf --show'. Some of the paths have been shortened manually for presentation purposes: $ cat communicate-inside-associate.f90 module foo contains subroutine bar() integer, save :: i[*]=0 associate(n=>1) print*,i[1] end associate end subroutine end module use foo end $ gfortran -I/opt/opencoarrays/include/OpenCoarrays-2.0.0-26-g840374a_GNU-8.0.1 -fcoarray=lib -Wl,-rpath -Wl,/opt/mpich/3.2/lib -Wl,--enable-new-dtags communicate-inside-associate.f90 /opt/opencoarrays/lib/libcaf_mpi.a /opt/mpich/3.2/lib/libmpifort.so /opt/mpich/3.2/lib/libmpi.so /tmp/ccA8dGYe.o: In function `_caf_init.1.3816': communicate-inside-associate.f90:(.text+0x4d): undefined reference to `caf_token.0.3815' /tmp/ccA8dGYe.o: In function `__foo_MOD_bar': communicate-inside-associate.f90:(.text+0x153): undefined reference to `caf_token.0.3815' collect2: error: ld returned 1 exit status rouson@sourcery-VirtualBox:~/Desktop/Builds/adhoc/src/gnu/nrc/emulated-collectives$ gfortran --version GNU Fortran (GCC) 8.0.1 20180412 (experimental)