[flang-commits] [flang] [flang][Semantics][OpenMP] Fix ICE for unknown reduction starting with . (PR #94398)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Tue Jun 4 13:27:33 PDT 2024
================
@@ -2321,9 +2321,17 @@ bool OmpStructureChecker::CheckReductionOperators(
common::visit(
common::visitors{
[&](const parser::DefinedOperator &dOpr) {
- const auto &intrinsicOp{
- std::get<parser::DefinedOperator::IntrinsicOperator>(dOpr.u)};
- ok = CheckIntrinsicOperator(intrinsicOp);
+ const auto *intrinsicOp{
+ std::get_if<parser::DefinedOperator::IntrinsicOperator>(
+ &dOpr.u)};
+ if (intrinsicOp) {
+ ok = CheckIntrinsicOperator(*intrinsicOp);
+ } else {
+ context_.Say(GetContext().clauseSource,
+ "Invalid reduction operator in REDUCTION "
----------------
klausler wrote:
It's best practice to not break error messages up over multiple lines, if you can help it. We want them to be easily found with `grep`.
https://github.com/llvm/llvm-project/pull/94398
More information about the flang-commits
mailing list