[flang-commits] [flang] [flang][OpenMP] Consider previous DSA for static duration variables (PR #143601)
via flang-commits
flang-commits at lists.llvm.org
Tue Jun 10 13:47:51 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp
Author: Kajetan Puchalski (mrkajetanp)
<details>
<summary>Changes</summary>
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@<!-- -->linaro.org>
---
Full diff: https://github.com/llvm/llvm-project/pull/143601.diff
1 Files Affected:
- (modified) flang/lib/Semantics/resolve-directives.cpp (+3-1)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/143601
More information about the flang-commits
mailing list