[flang-commits] [flang] [flang][OpenMP] Privatize loop IVs in the innermost parallel (PR #227486)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Mon Oct 5 05:49:38 PDT 2026
================
@@ -525,43 +491,55 @@ void DataSharingProcessor::collectSymbolsInNestedRegions(
llvm::SetVector<const semantics::Symbol *> &symbolsInNestedRegions) {
if (!eval.hasNestedEvaluations())
return;
+ const semantics::Scope *curScope = getCurrentScope(semaCtx, eval);
+ if (!curScope)
+ return;
----------------
tblah wrote:
My AI reviewer pointed out that these early returns prevent traversal into ordinary fortran language constructs e.g.
```
subroutine repro
integer :: k
k = 7
!$omp task
if (.true.) then
!$omp simd linear(k)
do k = 1, 10
end do
!$omp end simd
end if
!$omp end task
end subroutine
```
In this case, `k` is never made implicitly `firstprivate` in the outer `task` construct because there is no scope for `IF (.TRUE.) THEN`
https://github.com/llvm/llvm-project/pull/227486
More information about the flang-commits
mailing list