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

            Bug ID: 95551
           Summary: [OpenMP, OpenACC] -fopenmp/-fopenacc also with
                    -foffload=disable fails with: (.gnu.offload_vars+0x0):
                    undefined reference to `A.10.2'
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: openacc, openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

Loosely related to PR 95550 (for a variant of this test case, which fails with
an ICE).

The following test case fails to compile with -fopenmp or -fopenacc with:
   (.gnu.offload_vars+0x0): undefined reference to `A.10.2'
at least when offloading to AMDGCN (for nvidia, one runs into PR 65181) and
also with "-foffload=disable -O3".

Note: In order to reproduce this issue, an offloading compiler has to be
configured (configure-time set ENABLE_OFFLOADING has to evaluate to true) as
otherwise no .gnu.offload_vars is generated.


program main
  implicit none (type, external)
  integer :: j
  integer, allocatable :: A(:)

  A = [(3*j, j=1, 10)]
  call bar (A)
  deallocate (A)
contains
  subroutine bar (array)
    integer :: i
    integer :: array(:)

    !$omp target map(from:array)
    !$acc parallel copyout(array)
    array = [(-2*i, i = 1, size(array))]
    !$omp do private(array)
    !$acc loop gang private(array)
    do i = 1, 10
      array(i) = 9*i
    end do
    if (any (array /= [(-2*i, i = 1, 10)])) error stop 2
    !$omp end target
    !$acc end parallel
  end subroutine bar
end

Reply via email to