Mark the symbol with OmpShared, and then check that later in lowering to avoid making a local loop index. OpenMP 5.2 says: "Loop iteration variables of loops that are not associated with any OpenMP directive maybe listed in data-sharing attribute clauses on the surrounding teams, parallel or taskgenerating construct, and on enclosed constructs, subject to other restrictions." Tests updated to match the extra OmpShared attribute. Add regression test for lowering to hlfir. Closes #102961 --------- Co-authored-by: Tom Eccles <tom.eccles@arm.com>
19 lines
482 B
Fortran
19 lines
482 B
Fortran
! RUN: %python %S/../test_symbols.py %s %flang_fc1 -fopenmp
|
|
|
|
! OpenMP 5.2 5.1.1
|
|
! Iteration variables of non-associated loops may be listed in DSA clauses.
|
|
|
|
!DEF: /shared_iv (Subroutine)Subprogram
|
|
subroutine shared_iv
|
|
!DEF: /shared_iv/i ObjectEntity INTEGER(4)
|
|
integer i
|
|
|
|
!$omp parallel shared(i)
|
|
!$omp single
|
|
!DEF: /shared_iv/OtherConstruct1/i (OmpShared) HostAssoc INTEGER(4)
|
|
do i = 0, 1
|
|
end do
|
|
!$omp end single
|
|
!$omp end parallel
|
|
end subroutine
|