[flang-commits] [flang] [flang][Semantics] Fix updating flags of threadprivate symbols in presence of default clause (PR #78283)

via flang-commits flang-commits at lists.llvm.org
Tue Jan 16 06:10:02 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp

@llvm/pr-subscribers-flang-semantics

Author: None (NimishMishra)

<details>
<summary>Changes</summary>

Current semantic checks of default clause incorrectly update symbol flags related to threadprivate symbols. This patch adds an additional check to skip such updation should a symbol be already declared threadprivate.

Fixes https://github.com/llvm/llvm-project/issues/78282

---
Full diff: https://github.com/llvm/llvm-project/pull/78283.diff


1 Files Affected:

- (modified) flang/lib/Semantics/resolve-directives.cpp (+5) 


``````````diff
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index b30b81cf90c9517..c3e5578fe72f034 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1958,6 +1958,11 @@ void OmpAttributeVisitor::Post(const parser::Name &name) {
         }
       }
     }
+
+    if (Symbol * found{currScope().FindSymbol(name.source)}) {
+      if (found->test(semantics::Symbol::Flag::OmpThreadprivate))
+        return;
+    }
     std::vector<Symbol *> defaultDSASymbols;
     for (int dirDepth{0}; dirDepth < (int)dirContext_.size(); ++dirDepth) {
       DirContext &dirContext = dirContext_[dirDepth];

``````````

</details>


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


More information about the flang-commits mailing list