diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp index 4072dbf265944..398f6127cf275 100644 --- a/flang/runtime/io-stmt.cpp +++ b/flang/runtime/io-stmt.cpp @@ -1219,6 +1219,7 @@ bool InquireUnitState::Inquire( case HashInquiryKeyword("SIZE"): result = -1; if (unit().IsConnected()) { + unit().FlushOutput(*this); if (auto size{unit().knownSize()}) { result = *size; }