[flang-commits] [flang] 2496938 - [flang][runtime] Fix nonadvancing output edge case
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Jun 13 10:27:39 PDT 2022
Author: Peter Klausler
Date: 2022-06-13T10:27:27-07:00
New Revision: 2496938522aae3b1aec238397ab276827a06d417
URL: https://github.com/llvm/llvm-project/commit/2496938522aae3b1aec238397ab276827a06d417
DIFF: https://github.com/llvm/llvm-project/commit/2496938522aae3b1aec238397ab276827a06d417.diff
LOG: [flang][runtime] Fix nonadvancing output edge case
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.
Differential Revision: https://reviews.llvm.org/D127420
Added:
Modified:
flang/runtime/io-stmt.cpp
Removed:
################################################################################
diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp
index b29ab1524be27..98456766ecb93 100644
--- a/flang/runtime/io-stmt.cpp
+++ b/flang/runtime/io-stmt.cpp
@@ -325,10 +325,9 @@ void ExternalIoStatementState<DIR>::CompleteOperation() {
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);
}
More information about the flang-commits
mailing list