[flang-commits] [PATCH] D123716: [flang][runtime] Preserve effect of positioning in record in non-advancing output
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Apr 13 12:48:32 PDT 2022
klausler created this revision.
klausler added a reviewer: clementval.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.
When formatted non-advancing output ends in a control edit descriptor
like nX or Tn or TRn that effectively extends the record, fill any
gap with explicit blanks at the completion of the WRITE.
https://reviews.llvm.org/D123716
Files:
flang/runtime/io-stmt.cpp
Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -329,8 +329,16 @@
if (!mutableModes().nonAdvancing || GetIoStat() == IostatEor) {
FinishReadingRecord();
}
- } else {
- if (!mutableModes().nonAdvancing) {
+ } else { // output
+ 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;
+ } else {
+ unit().leftTabLimit.reset();
unit().AdvanceRecord(*this);
}
unit().FlushIfTerminal(*this);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123716.422608.patch
Type: text/x-patch
Size: 889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220413/dea7145d/attachment.bin>
More information about the flang-commits
mailing list