[flang-commits] [flang] [flang][runtime] Flush output before INQUIRE(..., SIZE=) (PR #75379)

via flang-commits flang-commits at lists.llvm.org
Wed Dec 13 13:02:33 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

Author: Peter Klausler (klausler)

<details>
<summary>Changes</summary>

Ensure that any buffered data has tranferred to an external unit before measuring its file size.

---
Full diff: https://github.com/llvm/llvm-project/pull/75379.diff


1 Files Affected:

- (modified) flang/runtime/io-stmt.cpp (+1) 


``````````diff
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;
       }

``````````

</details>


https://github.com/llvm/llvm-project/pull/75379


More information about the flang-commits mailing list