[flang-commits] [flang] [Flang][OpenMP] Fix implicit symbol resolution for USE-renamed arrays (PR #189215)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Thu Apr 9 11:53:41 PDT 2026


================
@@ -0,0 +1,40 @@
+! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
----------------
luporl wrote:

As @kiranchandramohan mentioned, it would be better to dump the symbols and check them instead of just test if no errors occurred.

You can use flang/test/Semantics/OpenMP/symbol06.f90 as an example.

Reducing the test can also help, by omitting parts that are not necessary to reproduce the issue, like the example below:

```f90
module use_rename_mod1
  implicit none
  real(8), allocatable :: ary(:,:,:)
end module

module use_rename_mod2
  implicit none
  real(8), allocatable :: ary(:,:,:,:,:)
end module

program test
  use use_rename_mod1, only: s_ary => ary
  use use_rename_mod2, only: ary
  implicit none
  integer(4) :: i

  !$omp parallel do
    do i = 1, 10
      s_ary(i,1,1) = ary(i,1,1,1,1)
    end do
  !$omp end parallel do
end program
```

Using more specific module names helps to avoid conflicts when running tests in parallel, as Flang writes .mod files for each module.

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


More information about the flang-commits mailing list