[flang-commits] [flang] [flang][openmp] Support importing module declare target globals (PR #213930)

Urvi Rav via flang-commits flang-commits at lists.llvm.org
Thu Aug 27 01:45:31 PDT 2026


ravurvi20 wrote:

I've been working on the same regression in [2188339](https://github.com/llvm/llvm-project/pull/218339), so I tested your PR with my reproducer as well, and it covers the case. 

Your fix is also more general than mine since it preserves the capture clause and handles functions too.

One small additional coverage point could be device-mode compilation (`-fopenmp-is-target-device`), since that's where the original issue shows up. I have the following test for that path:

```fortran
! mod.f90
module dt_mod
  implicit none
  integer :: arr(100)
  !$omp declare target enter(arr)
end module

! use.f90
subroutine sub(i)
  use dt_mod
  implicit none
  !$omp declare target
  integer :: i
  arr(i) = i
end subroutine
```

Feel free to fold this into the PR if you think it's useful. The existing coverage looks good to me otherwise.


https://github.com/llvm/llvm-project/pull/213930


More information about the flang-commits mailing list