https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115559

            Bug ID: 115559
           Summary: [OpenMP] 'link' clause of 'declare target' causes link
                    errors
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: openmp, rejects-valid, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

A C version of the following program compiles — for Fortran, the offload-device
LTO fails with:

link.f90:3:16: error: variable 'aaa' has been referenced in offloaded code but
hasn't been marked to be included in the offloaded code


module m
  implicit none
  integer :: AAA, BBB(10)
  !$omp declare target link(AAA,BBB)
end module m

subroutine sub()
  !$omp declare target
  use m
  implicit none
  AAA = 1
  BBB(5) = 7
end

external sub
!$omp target
  call sub
!$omp end target
end


Same issue for the larger (and more proper) OpenMP examples testcase:

https://github.com/OpenMP/Examples/blob/main/devices/sources/declare_target.6.f90

Reply via email to