Skip to content

Commit

Permalink
[flang][runtime] Flush output before INQUIRE(..., SIZE=) (#75379)
Browse files Browse the repository at this point in the history
Ensure that any buffered data has tranferred to an external unit before
measuring its file size.
  • Loading branch information
klausler committed Dec 26, 2023
1 parent 1794b61 commit 7b50176
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions flang/runtime/io-stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7b50176

Please sign in to comment.