[flang-commits] [flang] [flang][runtime] Flush output before INQUIRE(..., SIZE=) (PR #75379)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Wed Dec 13 13:02:01 PST 2023
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/75379
Ensure that any buffered data has tranferred to an external unit before measuring its file size.
>From 67dbdd5e6588104bfb23ba0fa41f5ac8290c60fa Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Wed, 13 Dec 2023 13:00:08 -0800
Subject: [PATCH] [flang][runtime] Flush output before INQUIRE(..., SIZE=)
Ensure that any buffered data has tranferred to an external unit
before measuring its file size.
---
flang/runtime/io-stmt.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp
index dedf1f8364ad37..e4f1076016fd22 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;
}
More information about the flang-commits
mailing list