[flang-commits] [flang] [flang][runtime] INQUIRE(UNIT=-666, EXIST=x) should be .FALSE. (PR #66239)
via flang-commits
flang-commits at lists.llvm.org
Wed Sep 13 09:52:30 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-runtime
<details>
<summary>Changes</summary>
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/llvm/llvm-project/pull/66239.diff
1 Files Affected:
- (modified) flang/runtime/io-stmt.cpp (+1-1)
<pre>
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"):
</pre>
</details>
https://github.com/llvm/llvm-project/pull/66239
More information about the flang-commits
mailing list