Skip to content
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

[flang][runtime] INQUIRE(UNIT=-666, EXIST=x) should be .FALSE. #66239

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

klausler
Copy link
Contributor

The runtime implementation for INQUIRE(EXIST=x) is returning .TRUE. for all non-existent unit, which is incorrect for valid unit numbers.

The runtime implementation for INQUIRE(EXIST=x) is returning
.TRUE. for all non-existent unit, which is incorrect for
valid unit numbers.

Pull request: llvm#66239
@klausler klausler requested a review from a team as a code owner September 13, 2023 16:51
@llvmbot llvmbot added flang:runtime flang Flang issues not falling into any other category labels Sep 13, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 13, 2023

@llvm/pr-subscribers-flang-runtime

Changes The runtime implementation for INQUIRE(EXIST=x) is returning .TRUE. for all non-existent unit, which is incorrect for valid unit numbers. -- Full diff: https://github.com//pull/66239.diff

1 Files Affected:

  • (modified) flang/runtime/io-stmt.cpp (+1-1)
diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp
index 6ce66911292a708..1d951a4157d3199 100644
--- a/flang/runtime/io-stmt.cpp
+++ b/flang/runtime/io-stmt.cpp
@@ -1271,7 +1271,7 @@ bool InquireNoUnitState::Inquire(
 bool InquireNoUnitState::Inquire(InquiryKeywordHash inquiry, bool &result) {
   switch (inquiry) {
   case HashInquiryKeyword("EXIST"):
-    result = true;
+    result = badUnitNumber() >= 0;
     return true;
   case HashInquiryKeyword("NAMED"):
   case HashInquiryKeyword("OPENED"):

@klausler klausler merged commit 79c4307 into llvm:main Sep 18, 2023
4 checks passed
@klausler klausler deleted the bug1349 branch September 18, 2023 15:39
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
…66239)

The runtime implementation for INQUIRE(EXIST=x) is returning .TRUE. for
all non-existent unit, which is incorrect for valid unit numbers.
zahiraam pushed a commit to tahonermann/llvm-project that referenced this pull request Oct 24, 2023
…66239)

The runtime implementation for INQUIRE(EXIST=x) is returning .TRUE. for
all non-existent unit, which is incorrect for valid unit numbers.
zahiraam pushed a commit to tahonermann/llvm-project that referenced this pull request Oct 24, 2023
…66239)

The runtime implementation for INQUIRE(EXIST=x) is returning .TRUE. for
all non-existent unit, which is incorrect for valid unit numbers.
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.

None yet

3 participants