-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[Frontend][OpenMP] Reduction modifier must be applied somewhere #92160
[Frontend][OpenMP] Reduction modifier must be applied somewhere #92160
Conversation
Detect the case when a reduction modifier ends up not being applied after construct decomposition, treat it as an error. This fixes a regression in the gfortran test suite after PR90098.
@llvm/pr-subscribers-flang-fir-hlfir @llvm/pr-subscribers-flang-openmp Author: Krzysztof Parzyszek (kparzysz) ChangesDetect the case when a reduction modifier ends up not being applied after construct decomposition, treat it as an error. This fixes a regression in the gfortran test suite after PR90098. Full diff: https://github.com/llvm/llvm-project/pull/92160.diff 1 Files Affected:
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index 5f12c62b832fc..e5fcc493ea590 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -930,7 +930,8 @@ bool ConstructDecompositionT<C, H>::applyClause(
// Apply clause without modifier.
leaf.clauses.push_back(unmodified);
}
- applied = true;
+ // The modifier must be applied to some construct.
+ applied = effectiveApplied;
}
if (!applied)
|
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.
If it isn't too time consuming, please could you add a test for this to the flang test suite so that we catch this bug with the regular build bots next time.
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 for adding the test
@kparzysz, I'm still getting an assertion in Decomposer.cpp with my internal test even with this latest change. Are you still working on this, or should I work to create a small reproducer? |
This test uses an invalid reduction modifier for this construct. Before this fix we just silently dropped the modifier, now we will assert. I will open a follow-up issue to have this detected in the semantic checks and emit a user-friendly error. Does your code have this specific combination of reduction/construct? IIRC, it asserted before any of the follow up fixes, so it's likely a different problem. Please do create a testcase for it. Edit: @psteinfeld In case you missed my previous message: please send me a testcase for the crash you're seeing. |
Detect the case when a reduction modifier ends up not being applied after construct decomposition, treat it as an error.
This fixes a regression in the gfortran test suite after #90098.