[flang-commits] [PATCH] D127797: [flang] ERROR STOP is not an image control statement

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 14 14:06:19 PDT 2022


klausler created this revision.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

The predicate that determines image control statements needs
to distinguish STOP (which is) from ERROR STOP (which isn't).


https://reviews.llvm.org/D127797

Files:
  flang/lib/Semantics/tools.cpp


Index: flang/lib/Semantics/tools.cpp
===================================================================
--- flang/lib/Semantics/tools.cpp
+++ flang/lib/Semantics/tools.cpp
@@ -875,11 +875,11 @@
 }
 
 class ImageControlStmtHelper {
-  using ImageControlStmts = std::variant<parser::ChangeTeamConstruct,
-      parser::CriticalConstruct, parser::EventPostStmt, parser::EventWaitStmt,
-      parser::FormTeamStmt, parser::LockStmt, parser::StopStmt,
-      parser::SyncAllStmt, parser::SyncImagesStmt, parser::SyncMemoryStmt,
-      parser::SyncTeamStmt, parser::UnlockStmt>;
+  using ImageControlStmts =
+      std::variant<parser::ChangeTeamConstruct, parser::CriticalConstruct,
+          parser::EventPostStmt, parser::EventWaitStmt, parser::FormTeamStmt,
+          parser::LockStmt, parser::SyncAllStmt, parser::SyncImagesStmt,
+          parser::SyncMemoryStmt, parser::SyncTeamStmt, parser::UnlockStmt>;
 
 public:
   template <typename T> bool operator()(const T &) {
@@ -929,6 +929,11 @@
     }
     return false;
   }
+  bool operator()(const parser::StopStmt &stmt) {
+    // STOP is an image control statement; ERROR STOP is not
+    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);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127797.436933.patch
Type: text/x-patch
Size: 1369 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220614/a9546809/attachment-0001.bin>


More information about the flang-commits mailing list