[flang-commits] [flang] [flang][OpenMP] Don't pritvatize pre-determined symbols declare by nested `BLOCK`s (PR #152652)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Fri Aug 8 04:50:37 PDT 2025


================
@@ -553,8 +553,16 @@ void DataSharingProcessor::collectSymbols(
       return sym->test(semantics::Symbol::Flag::OmpImplicit);
     }
 
-    if (collectPreDetermined)
-      return sym->test(semantics::Symbol::Flag::OmpPreDetermined);
+    if (collectPreDetermined) {
+      // Collect pre-determined symbols only if they are defined by the current
+      // OpenMP evaluation. If `sym` is not defined by the current OpenMP
+      // evaluation then it is defined by a block nested within the OpenMP
+      // construct. This, in turn, means that the private allocation for the
+      // symbol will be emitted as part of the nested block and there is no need
+      // to prvatize it within the OpenMP construct.
----------------
skatrak wrote:

```suggestion
      // to privatize it within the OpenMP construct.
```

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


More information about the flang-commits mailing list