[flang-commits] [flang] [Flang][OpenMP] Add Semantics support for Nested OpenMPLoopConstructs (PR #145917)
David Spickett via flang-commits
flang-commits at lists.llvm.org
Tue Jul 8 06:00:51 PDT 2025
DavidSpickett wrote:
> In this one case I wrapped the following "if" in "if (nextIt != block.end())" and that fixed the problem.
On Windows on Arm, the following hack passes all tests and hammering the specific tests produced no failures:
```
diff --git a/flang/lib/Semantics/canonicalize-omp.cpp b/flang/lib/Semantics/canonicalize-omp.cpp
index 1edcb376596b..f33d161d6870 100644
--- a/flang/lib/Semantics/canonicalize-omp.cpp
+++ b/flang/lib/Semantics/canonicalize-omp.cpp
@@ -151,12 +151,14 @@ private:
std::move(*doCons);
nextIt = block.erase(nextIt);
// try to match OmpEndLoopDirective
+ if (nextIt != block.end()) {
if (auto *endDir{
GetConstructIf<parser::OmpEndLoopDirective>(*nextIt)}) {
std::get<std::optional<parser::OmpEndLoopDirective>>(x.t) =
std::move(*endDir);
nextIt = block.erase(nextIt);
}
+ }
} else {
messages_.Say(dir.source,
"DO loop after the %s directive must have loop control"_err_en_US,
```
https://github.com/llvm/llvm-project/pull/145917
More information about the flang-commits
mailing list