-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang][Semantics] Fix updating flags of threadprivate symbols in presence of default clause #78283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][Semantics] Fix updating flags of threadprivate symbols in presence of default clause #78283
Conversation
@llvm/pr-subscribers-flang-fir-hlfir @llvm/pr-subscribers-flang-semantics Author: None (NimishMishra) ChangesCurrent 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 #78282 Full diff: https://github.com/llvm/llvm-project/pull/78283.diff 1 Files Affected:
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];
|
It would be nice to add a test for this. |
7289604
to
47f4208
Compare
Thank you @luporl for the comment! I've added a test case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case looks good, thanks!
Skipping threadprivate symbols from default clause processing makes sense to me.
Ping for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
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 #78282