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 @@ -388,6 +388,9 @@ template int ExternalFormattedIoStatementState::EndIoStatement() { + if constexpr (DIR == Direction::Input) { + this->BeginReadingRecord(); // in case there were no I/O items + } format_.Finish(*this); return ExternalIoStatementState::EndIoStatement(); }