-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang][OpenMP] Don't abort when default is used on an invalid directive #107586
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
Conversation
The previous assert was not considering programs with semantic errors. Fixes llvm#107495
@llvm/pr-subscribers-flang-openmp @llvm/pr-subscribers-flang-semantics Author: Leandro Lupori (luporl) ChangesThe previous assert was not considering programs with semantic errors. Fixes #107495 Full diff: https://github.com/llvm/llvm-project/pull/107586.diff 1 Files Affected:
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 4aecb8b8e7b479..01ce8d989fdd15 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -2152,7 +2152,9 @@ void OmpAttributeVisitor::CreateImplicitSymbols(
dirContext.defaultDSA == Symbol::Flag::OmpShared) {
// 1) default
// Allowed only with parallel, teams and task generating constructs.
- assert(parallelDir || taskGenDir || teamsDir);
+ if (!parallelDir && !taskGenDir && !teamsDir) {
+ return;
+ }
if (dirContext.defaultDSA != Symbol::Flag::OmpShared)
makePrivateSymbol(dirContext.defaultDSA);
else
|
Now that I noticed that this is practically the same fix as in #93438. |
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.
Looks good.
I see this now hits a semantic error instead: "DEFAULT clause is not allowed on the DO directive". There doesn't seem to be a unit test for this currently. Please could you add one so we can verify that it doesn't crash.
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
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.
Thanks @luporl . This looks good.
The previous assert was not considering programs with semantic errors.
Fixes #107495
Fixes #93437