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

via flang-commits flang-commits at lists.llvm.org
Tue Dec 26 15:40:23 PST 2023


Author: Peter Klausler
Date: 2023-12-26T15:40:19-08:00
New Revision: 7b50176805ff53994ab87bbce7c3b7840bbc85ab

URL: https://github.com/llvm/llvm-project/commit/7b50176805ff53994ab87bbce7c3b7840bbc85ab
DIFF: https://github.com/llvm/llvm-project/commit/7b50176805ff53994ab87bbce7c3b7840bbc85ab.diff

LOG: [flang][runtime] Flush output before INQUIRE(..., SIZE=) (#75379)

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

Added: 
    

Modified: 
    flang/runtime/io-stmt.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp
index 4072dbf2659449..398f6127cf2758 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