[PATCH] D114028: [flang] Fix INQUIRE(PAD=) and (POSITION=) for predefined units

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 17 16:27:46 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd6b7576f210b: [flang] Fix INQUIRE(PAD=) and (POSITION=) for predefined units (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114028

Files:
  flang/runtime/io-stmt.cpp
  flang/runtime/unit.cpp


Index: flang/runtime/unit.cpp
===================================================================
--- flang/runtime/unit.cpp
+++ flang/runtime/unit.cpp
@@ -215,11 +215,13 @@
   RUNTIME_CHECK(terminator, !wasExtant);
   out.Predefine(1);
   out.SetDirection(Direction::Output, handler);
+  out.isUnformatted = false;
   defaultOutput = &out;
   ExternalFileUnit &in{newUnitMap->LookUpOrCreate(5, terminator, wasExtant)};
   RUNTIME_CHECK(terminator, !wasExtant);
   in.Predefine(0);
   in.SetDirection(Direction::Input, handler);
+  in.isUnformatted = false;
   defaultInput = ∈
   // TODO: Set UTF-8 mode from the environment
   unitMap = newUnitMap;
Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -915,7 +915,7 @@
       auto pos{unit().position()};
       if (pos == size.value_or(pos + 1)) {
         str = "APPEND";
-      } else if (pos == 0) {
+      } else if (pos == 0 && unit().mayPosition()) {
         str = "REWIND";
       } else {
         str = "ASIS"; // processor-dependent & no common behavior


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114028.388061.patch
Type: text/x-patch
Size: 1132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211118/3523d78f/attachment.bin>


More information about the llvm-commits mailing list