[flang-commits] [flang] 7db0610 - [flang] INQUIRE(FILE=path, READ/READWRITE/WRITE=x) should be UNKNOWN when unknown
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Aug 28 14:46:13 PDT 2023
Author: Peter Klausler
Date: 2023-08-28T14:46:00-07:00
New Revision: 7db0610c0620a50c3abd9c4d518b63f5cb61f0a8
URL: https://github.com/llvm/llvm-project/commit/7db0610c0620a50c3abd9c4d518b63f5cb61f0a8
DIFF: https://github.com/llvm/llvm-project/commit/7db0610c0620a50c3abd9c4d518b63f5cb61f0a8.diff
LOG: [flang] INQUIRE(FILE=path, READ/READWRITE/WRITE=x) should be UNKNOWN when unknown
For nonexistent or inaccessible files, we're returning NO, which is
indeed true, but we should return UNKNOWN instead.
Differential Revision: https://reviews.llvm.org/D158653
Added:
Modified:
flang/runtime/io-stmt.cpp
Removed:
################################################################################
diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp
index 4be7e6135c04f0..6ce66911292a70 100644
--- a/flang/runtime/io-stmt.cpp
+++ b/flang/runtime/io-stmt.cpp
@@ -1347,13 +1347,16 @@ bool InquireUnconnectedFileState::Inquire(
str = "UNKNONN";
break;
case HashInquiryKeyword("READ"):
- str = MayRead(path_.get()) ? "YES" : "NO";
+ str =
+ IsExtant(path_.get()) ? MayRead(path_.get()) ? "YES" : "NO" : "UNKNOWN";
break;
case HashInquiryKeyword("READWRITE"):
- str = MayReadAndWrite(path_.get()) ? "YES" : "NO";
+ str = IsExtant(path_.get()) ? MayReadAndWrite(path_.get()) ? "YES" : "NO"
+ : "UNKNOWN";
break;
case HashInquiryKeyword("WRITE"):
- str = MayWrite(path_.get()) ? "YES" : "NO";
+ str = IsExtant(path_.get()) ? MayWrite(path_.get()) ? "YES" : "NO"
+ : "UNKNOWN";
break;
case HashInquiryKeyword("NAME"):
str = path_.get();
More information about the flang-commits
mailing list