Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 26, 2023

Conversation

klausler
Copy link
Contributor

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

Ensure that any buffered data has tranferred to an external unit
before measuring its file size.
@klausler klausler requested a review from clementval December 13, 2023 21:01
@llvmbot llvmbot added flang:runtime flang Flang issues not falling into any other category labels Dec 13, 2023
@llvmbot
Copy link
Member

llvmbot commented Dec 13, 2023

@llvm/pr-subscribers-flang-runtime

Author: Peter Klausler (klausler)

Changes

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

Copy link
Contributor

@clementval clementval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@klausler klausler merged commit 7b50176 into llvm:main Dec 26, 2023
@klausler klausler deleted the inquire-size branch December 26, 2023 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:runtime flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants