[flang-commits] [PATCH] D122509: [flang] Catch bad OPEN(STATUS=) cases

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Mar 25 18:25:08 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG435641bc3d8e: [flang] Catch bad OPEN(STATUS=) cases (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122509

Files:
  flang/runtime/io-stmt.cpp


Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -232,6 +232,14 @@
       position_.reset();
     }
   }
+  if (status_) { // 12.5.6.10
+    if ((*status_ == OpenStatus::New || *status_ == OpenStatus::Replace) &&
+        !path_.get()) {
+      SignalError("FILE= required on OPEN with STATUS='NEW' or 'REPLACE'");
+    } else if (*status_ == OpenStatus::Scratch && path_.get()) {
+      SignalError("FILE= may not appear on OPEN with STATUS='SCRATCH'");
+    }
+  }
   if (path_.get() || wasExtant_ ||
       (status_ && *status_ == OpenStatus::Scratch)) {
     unit().OpenUnit(status_, action_, position_.value_or(Position::AsIs),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122509.418363.patch
Type: text/x-patch
Size: 748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220326/2b7aa489/attachment.bin>


More information about the flang-commits mailing list