Skip to content

Commit

Permalink
[flang] Pad output correctly after tabbing with ADVANCE='no' (bug#63111)
Browse files Browse the repository at this point in the history
Correct the code that implements the production of spaces to bring the
furthestPositionInRecord up to a positionInRecord that was tabbed forward
by a T or TR control edit descriptor.

Fixes bug #63111.

Differential Revision: https://reviews.llvm.org/D152201
  • Loading branch information
klausler committed Jun 5, 2023
1 parent 62a06d8 commit 885b904
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flang/runtime/io-stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ void ExternalIoStatementState<DIR>::CompleteOperation() {
} else { // output
if (mutableModes().nonAdvancing) {
// Make effects of positioning past the last Emit() visible with blanks.
std::int64_t n{unit().positionInRecord - unit().furthestPositionInRecord};
while (n-- > 0 && unit().Emit(" ", 1, 1, *this)) {
if (unit().positionInRecord > unit().furthestPositionInRecord) {
unit().Emit("", 0, 1, *this); // Emit() will pad
}
unit().leftTabLimit = unit().positionInRecord;
} else {
Expand Down

0 comments on commit 885b904

Please sign in to comment.