[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:09:32 PST 2024
https://github.com/NimishMishra created https://github.com/llvm/llvm-project/pull/78283
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
>From 72896040da8ba3ba0fe4dd38e013de03dfb280e8 Mon Sep 17 00:00:00 2001
From: Nimish Mishra <neelam.nimish at gmail.com>
Date: Tue, 16 Jan 2024 19:17:07 +0530
Subject: [PATCH] [flang][Semantics] Fix updating threadprivate symbols in
presence of default clause
---
flang/lib/Semantics/resolve-directives.cpp | 5 +++++
1 file changed, 5 insertions(+)
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];
More information about the flang-commits
mailing list