[flang-commits] [PATCH] D151134: [flang][runtime] Complete partial output records when positioning/closing after non-advancing output

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue May 23 15:55:12 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG472913c7ef74: [flang][runtime] Complete partial output records when positioning/closing after… (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151134

Files:
  flang/runtime/unit.cpp


Index: flang/runtime/unit.cpp
===================================================================
--- flang/runtime/unit.cpp
+++ flang/runtime/unit.cpp
@@ -893,6 +893,12 @@
 }
 
 void ExternalFileUnit::DoImpliedEndfile(IoErrorHandler &handler) {
+  if (!impliedEndfile_ && direction_ == Direction::Output && IsRecordFile() &&
+      access != Access::Direct && leftTabLimit) {
+    // Complete partial record after non-advancing write before
+    // positioning or closing the unit.  Usually sets impliedEndfile_.
+    AdvanceRecord(handler);
+  }
   if (impliedEndfile_) {
     impliedEndfile_ = false;
     if (access != Access::Direct && IsRecordFile() && mayPosition()) {
@@ -905,7 +911,7 @@
   if (IsRecordFile() && access != Access::Direct) {
     furthestPositionInRecord =
         std::max(positionInRecord, furthestPositionInRecord);
-    if (furthestPositionInRecord > 0) {
+    if (leftTabLimit) {
       // Last read/write was non-advancing, so AdvanceRecord() was not called.
       leftTabLimit.reset();
       ++currentRecordNumber;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151134.524923.patch
Type: text/x-patch
Size: 1049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230523/08a299ec/attachment.bin>


More information about the flang-commits mailing list