forked from OSchip/llvm-project
[flang][runtime] Preserve effect of positioning in record in non-advancing output
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. Differential Revision: https://reviews.llvm.org/D123716
This commit is contained in:
parent
724709e09d
commit
a68612a964
|
@ -318,8 +318,13 @@ void ExternalIoStatementState<DIR>::CompleteOperation() {
|
|||
if (!mutableModes().nonAdvancing || GetIoStat() == IostatEor) {
|
||||
FinishReadingRecord();
|
||||
}
|
||||
} else {
|
||||
} 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();
|
||||
|
|
Loading…
Reference in New Issue