[flang-commits] [flang] [flang][OpenMP] Make static duration variables default to shared DSA (PR #142783)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Thu Jun 5 11:37:54 PDT 2025


================
@@ -2372,11 +2374,16 @@ void OmpAttributeVisitor::CreateImplicitSymbols(const Symbol *symbol) {
         dsa = {Symbol::Flag::OmpShared};
         makeSymbol(dsa);
         PRINT_IMPLICIT_RULE("6) taskgen: shared");
+      } else if (isStaticStorageDuration) {
+        // 7) variables with static storage duration are predetermined as shared
+        dsa = {Symbol::Flag::OmpShared};
+        makeSymbol(dsa);
+        PRINT_IMPLICIT_RULE("7) taskgen: shared (static storage duration)");
----------------
luporl wrote:

It's still unclear to me which implicit (or predetermined?) rule is being applied in this case.
But if it's the one describing task-generating constructs in which the variable is shared in the enclosing context, it would be better to keep it within rule "6".

Each implicit rule here corresponds to a bullet in OpenMP 5.2 5.1.1, in the part that it describes the rules for variables with implicitly determined data-sharing attributes.

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


More information about the flang-commits mailing list