[flang-commits] [PATCH] D88612: flang] Fix buffering read->write transition

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Oct 1 17:14:56 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG61687f3a48c2: [flang] Fix buffering read->write transition (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88612

Files:
  flang/runtime/buffer.h
  flang/runtime/io-api.cpp


Index: flang/runtime/io-api.cpp
===================================================================
--- flang/runtime/io-api.cpp
+++ flang/runtime/io-api.cpp
@@ -518,7 +518,7 @@
   }
   connection.currentRecordNumber = rec;
   if (auto *unit{io.GetExternalFileUnit()}) {
-    unit->SetPosition(rec * *connection.recordLength);
+    unit->SetPosition((rec - 1) * *connection.recordLength);
   }
   return true;
 }
Index: flang/runtime/buffer.h
===================================================================
--- flang/runtime/buffer.h
+++ flang/runtime/buffer.h
@@ -94,7 +94,7 @@
         start_ + (at - fileOffset_) + static_cast<std::int64_t>(bytes) >
             size_) {
       Flush(handler);
-      fileOffset_ = at;
+      Reset(at);
       Reallocate(bytes, handler);
     }
     dirty_ = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88612.295699.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20201002/14bfadb5/attachment-0001.bin>


More information about the flang-commits mailing list