[flang-commits] [PATCH] D127420: [flang][runtime] Fix nonadvancing output edge case

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Jun 9 12:03:21 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.

When nonadvancing output uses T/TL control edit descriptors to reposition
the record, don't reset the position to the furthest point written at
the end of the write.


https://reviews.llvm.org/D127420

Files:
  flang/runtime/io-stmt.cpp


Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -325,10 +325,9 @@
     if (mutableModes().nonAdvancing) {
       // Make effects of positioning past the last Emit() visible with blanks.
       std::int64_t n{unit().positionInRecord - unit().furthestPositionInRecord};
-      unit().positionInRecord = unit().furthestPositionInRecord;
       while (n-- > 0 && unit().Emit(" ", 1, 1, *this)) {
       }
-      unit().leftTabLimit = unit().furthestPositionInRecord;
+      unit().leftTabLimit = unit().positionInRecord;
     } else {
       unit().AdvanceRecord(*this);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127420.435628.patch
Type: text/x-patch
Size: 690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220609/8bb1330e/attachment.bin>


More information about the flang-commits mailing list