[flang-commits] [PATCH] D146584: [flang] Detect image control statements in non-construct IF statements

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Mar 27 17:13:42 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1b56f273b271: [flang] Detect image control statements in non-construct IF statements (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146584/new/

https://reviews.llvm.org/D146584

Files:
  flang/lib/Semantics/tools.cpp
  flang/test/Semantics/doconcurrent01.f90


Index: flang/test/Semantics/doconcurrent01.f90
===================================================================
--- flang/test/Semantics/doconcurrent01.f90
+++ flang/test/Semantics/doconcurrent01.f90
@@ -22,6 +22,11 @@
      SYNC IMAGES (*)
 !ERROR: An image control statement is not allowed in DO CONCURRENT
      SYNC MEMORY
+!ERROR: An image control statement is not allowed in DO CONCURRENT
+     stop
+!ERROR: An image control statement is not allowed in DO CONCURRENT
+     if (.false.) stop
+     error stop ! ok
 !ERROR: RETURN is not allowed in DO CONCURRENT
      return
 10 continue
Index: flang/lib/Semantics/tools.cpp
===================================================================
--- flang/lib/Semantics/tools.cpp
+++ flang/lib/Semantics/tools.cpp
@@ -848,6 +848,9 @@
   template <typename T> bool operator()(const common::Indirection<T> &x) {
     return (*this)(x.value());
   }
+  template <typename A> bool operator()(const parser::Statement<A> &x) {
+    return (*this)(x.statement);
+  }
   bool operator()(const parser::AllocateStmt &stmt) {
     const auto &allocationList{std::get<std::list<parser::Allocation>>(stmt.t)};
     for (const auto &allocation : allocationList) {
@@ -894,8 +897,13 @@
     return std::get<parser::StopStmt::Kind>(stmt.t) ==
         parser::StopStmt::Kind::Stop;
   }
-  bool operator()(const parser::Statement<parser::ActionStmt> &stmt) {
-    return common::visit(*this, stmt.statement.u);
+  bool operator()(const parser::IfStmt &stmt) {
+    return (*this)(
+        std::get<parser::UnlabeledStatement<parser::ActionStmt>>(stmt.t)
+            .statement);
+  }
+  bool operator()(const parser::ActionStmt &stmt) {
+    return common::visit(*this, stmt.u);
   }
 
 private:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146584.508850.patch
Type: text/x-patch
Size: 1738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230328/334a20ce/attachment-0001.bin>


More information about the flang-commits mailing list