diff --git a/flang/runtime/connection.h b/flang/runtime/connection.h --- a/flang/runtime/connection.h +++ b/flang/runtime/connection.h @@ -47,7 +47,6 @@ void BeginRecord() { positionInRecord = 0; furthestPositionInRecord = 0; - leftTabLimit.reset(); } std::optional EffectiveRecordLength() const { diff --git a/flang/runtime/io-stmt.h b/flang/runtime/io-stmt.h --- a/flang/runtime/io-stmt.h +++ b/flang/runtime/io-stmt.h @@ -406,7 +406,6 @@ ExternalFileUnit &unit() { return unit_; } MutableModes &mutableModes(); ConnectionState &GetConnectionState(); - void CompleteOperation(); int EndIoStatement(); ExternalFileUnit *GetExternalFileUnit() const { return &unit_; } diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp --- a/flang/runtime/io-stmt.cpp +++ b/flang/runtime/io-stmt.cpp @@ -199,17 +199,6 @@ ConnectionState &ExternalIoStatementBase::GetConnectionState() { return unit_; } -void ExternalIoStatementBase::CompleteOperation() { - if (!completedOperation()) { - if (mutableModes().nonAdvancing) { - unit_.leftTabLimit = unit_.furthestPositionInRecord; - } else { - unit_.leftTabLimit.reset(); - } - IoStatementBase::CompleteOperation(); - } -} - int ExternalIoStatementBase::EndIoStatement() { CompleteOperation(); auto result{IoStatementBase::EndIoStatement()}; @@ -330,12 +319,15 @@ FinishReadingRecord(); } } else { - if (!mutableModes().nonAdvancing) { + if (mutableModes().nonAdvancing) { + unit().leftTabLimit = unit().furthestPositionInRecord; + } else { + unit().leftTabLimit.reset(); unit().AdvanceRecord(*this); } unit().FlushIfTerminal(*this); } - return ExternalIoStatementBase::CompleteOperation(); + return IoStatementBase::CompleteOperation(); } template int ExternalIoStatementState::EndIoStatement() { @@ -1013,7 +1005,7 @@ ext.Rewind(*this); break; } - return ExternalIoStatementBase::CompleteOperation(); + return IoStatementBase::CompleteOperation(); } int ExternalMiscIoStatementState::EndIoStatement() { diff --git a/flang/runtime/unit.h b/flang/runtime/unit.h --- a/flang/runtime/unit.h +++ b/flang/runtime/unit.h @@ -83,7 +83,6 @@ const char *, std::size_t, std::size_t elementBytes, IoErrorHandler &); bool Receive(char *, std::size_t, std::size_t elementBytes, IoErrorHandler &); std::size_t GetNextInputBytes(const char *&, IoErrorHandler &); - void SetLeftTabLimit(); bool BeginReadingRecord(IoErrorHandler &); void FinishReadingRecord(IoErrorHandler &); bool AdvanceRecord(IoErrorHandler &); diff --git a/flang/runtime/unit.cpp b/flang/runtime/unit.cpp --- a/flang/runtime/unit.cpp +++ b/flang/runtime/unit.cpp @@ -410,11 +410,6 @@ return false; } -void ExternalFileUnit::SetLeftTabLimit() { - leftTabLimit = furthestPositionInRecord; - positionInRecord = furthestPositionInRecord; -} - bool ExternalFileUnit::BeginReadingRecord(IoErrorHandler &handler) { RUNTIME_CHECK(handler, direction_ == Direction::Input); if (!beganReadingRecord_) {