File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1649,6 +1649,15 @@ void OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
16491649 break ;
16501650 }
16511651 }
1652+ // If this symbol already has a data-sharing attribute then there is nothing
1653+ // to do here.
1654+ if (const Symbol * symbol{iv.symbol }) {
1655+ for (auto symMap : targetIt->objectWithDSA ) {
1656+ if (symMap.first ->name () == symbol->name ()) {
1657+ return ;
1658+ }
1659+ }
1660+ }
16521661 // If this symbol is already Private or Firstprivate in the enclosing
16531662 // OpenMP parallel or task then there is nothing to do here.
16541663 if (auto *symbol{targetIt->scope .FindSymbol (iv.source )}) {
Original file line number Diff line number Diff line change 1+ ! RUN: %python %S/../test_symbols.py %s %flang_fc1 -fopenmp
2+
3+ ! OpenMP 5.2 5.1.1
4+ ! Iteration variables of non-associated loops may be listed in DSA clauses.
5+
6+ ! DEF: /shared_iv (Subroutine)Subprogram
7+ subroutine shared_iv
8+ ! DEF: /shared_iv/i ObjectEntity INTEGER(4)
9+ integer i
10+
11+ ! $omp parallel shared(i)
12+ ! $omp single
13+ ! REF: /shared_iv/i
14+ do i = 0 , 1
15+ end do
16+ ! $omp end single
17+ ! $omp end parallel
18+ end subroutine
You can’t perform that action at this time.
0 commit comments