[flang-commits] [flang] [flang][OpenMP] Don't allow DO CONCURRENT inside of a loop nest (PR #144506)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Jun 17 10:41:16 PDT 2025


================
@@ -1952,6 +1952,12 @@ void OmpAttributeVisitor::PrivatizeAssociatedLoopIndexAndCheckLoopLevel(
   const auto &outer{std::get<std::optional<parser::DoConstruct>>(x.t)};
   if (outer.has_value()) {
     for (const parser::DoConstruct *loop{&*outer}; loop && level > 0; --level) {
+      if (loop->IsDoConcurrent()) {
+        auto &stmt =
+            std::get<parser::Statement<parser::NonLabelDoStmt>>(loop->t);
+        context_.Say(stmt.source,
+            "DO CONCURRENT loops cannot form part of a loop nest."_err_en_US);
+      }
----------------
tblah wrote:

Thanks for pointing this out.

> If the collapsed loop is a DO CONCURRENT loop, neither the data-sharing attribute clauses nor the collapse clause may be specified.

I am taking this to mean that DO CONCURRENT is allowed with LOOP, but not when LOOP has a COLLAPSE clause. "Collapsed loop" seems elsewhere to refer to anything enclosed by the LOOP construct.



https://github.com/llvm/llvm-project/pull/144506


More information about the flang-commits mailing list