[flang-commits] [flang] [flang][OpenMP] Consider previous DSA for static duration variables (PR #143601)
Kajetan Puchalski via flang-commits
flang-commits at lists.llvm.org
Tue Jun 10 13:47:15 PDT 2025
https://github.com/mrkajetanp created https://github.com/llvm/llvm-project/pull/143601
Symbols that have a pre-existing DSA set in the enclosing context should not be made shared based on them being static duration variables.
Suggested-by: Leandro Lupori <leandro.lupori at linaro.org>
>From ca002b75283d97303eb1577ac072675bbf805e3a Mon Sep 17 00:00:00 2001
From: Kajetan Puchalski <kajetan.puchalski at arm.com>
Date: Tue, 10 Jun 2025 20:40:05 +0000
Subject: [PATCH] [flang][OpenMP] Consider previous DSA for static duration
variables
Symbols that have a pre-existing DSA set in the enclosing context
should not be made shared based on them being static duration
variables.
Suggested-by: Leandro Lupori <leandro.lupori at linaro.org>
Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
---
flang/lib/Semantics/resolve-directives.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 65823adcef19d..93bf510fbc3c7 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -2382,7 +2382,9 @@ void OmpAttributeVisitor::CreateImplicitSymbols(const Symbol *symbol) {
dsa = prevDSA;
} else if (taskGenDir) {
// TODO 5) dummy arg in orphaned taskgen construct -> firstprivate
- if (prevDSA.test(Symbol::Flag::OmpShared) || isStaticStorageDuration) {
+ if (prevDSA.test(Symbol::Flag::OmpShared) ||
+ (isStaticStorageDuration &&
+ (prevDSA & dataSharingAttributeFlags).none())) {
// 6) shared in enclosing context -> shared
dsa = {Symbol::Flag::OmpShared};
makeSymbol(dsa);
More information about the flang-commits
mailing list