!-- This is a reproducer of an issue observed in an ECP application. ! The issue seems to stem from a declared target array variables ! being used as arguments to nested declared-target ! subroutines. The error happens at the linking stage. !-- There could be two possible distinct issues here with CCE. ! The first one is as written in the code. ! The second one shows up when '!$OMP private' in gpuomp_routine() ! is commented out. It triggers a different linking error. module comm implicit none real, dimension ( : ), allocatable :: & cmaxa, cmaxb !$OMP declare target ( cmaxa, cmaxb ) integer :: & ncmax end module comm module ext_module implicit none contains subroutine ext_routine ( d1, cmaxa, cmaxb, size ) implicit none real, intent ( inout ) :: & d1 integer, intent ( in ) :: & size real, dimension ( : ) :: & cmaxa ( size ), cmaxb ( size ) !$OMP declare target end subroutine ext_routine end module ext_module module gpuomp implicit none contains subroutine gpuomp_routine ( d1 ) use comm, only: cmaxa, cmaxb, ncmax real, intent ( inout ) :: & d1 integer :: & iV !$OMP target teams distribute parallel do & !$OMP private ( cmaxa, cmaxb ) do iV = 1, 3200 call gpuomp_routine2 ( d1, cmaxa, cmaxb, ncmax ) end do !$OMP end target teams distribute parallel do end subroutine gpuomp_routine subroutine gpuomp_routine2 ( d1, cmaxa, cmaxb, size ) use ext_module real, intent ( inout ) :: & d1 integer, intent ( in ) :: & size real, dimension ( : ) :: & cmaxa, cmaxb !$OMP declare target call ext_routine ( d1, cmaxa, cmaxb, size ) end subroutine gpuomp_routine2 end module gpuomp program test !-- Dummy 'main' program so that we can link. end program test