[flang-commits] [PATCH] D112742: [flang] Revert new unintended runtime behavior

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Oct 28 11:17:58 PDT 2021


klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.

A recent change caused some variable-length sequential formatted
output statements with record positioning at the end of a FORMAT
(e.g., FORMAT('hi',10X) to append blanks at the end of the completed
record when emitting it.


https://reviews.llvm.org/D112742

Files:
  flang/runtime/unit.cpp


Index: flang/runtime/unit.cpp
===================================================================
--- flang/runtime/unit.cpp
+++ flang/runtime/unit.cpp
@@ -455,6 +455,7 @@
       furthestPositionInRecord = *recordLength;
     }
     if (!(isFixedRecordLength && access == Access::Direct)) {
+      positionInRecord = furthestPositionInRecord;
       if (isUnformatted.value_or(false)) {
         // Append the length of a sequential unformatted variable-length record
         // as its footer, then overwrite the reserved first four bytes of the
@@ -464,7 +465,6 @@
         // headers &/or footers
         std::uint32_t length;
         length = furthestPositionInRecord - sizeof length;
-        positionInRecord = furthestPositionInRecord;
         ok = ok &&
             Emit(reinterpret_cast<const char *>(&length), sizeof length,
                 sizeof length, handler);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112742.383098.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211028/d5dca218/attachment.bin>


More information about the flang-commits mailing list