[flang-commits] [PATCH] D158653: [flang][runtime] INQUIRE(FILE=path, READ/READWRITE/WRITE=x) should be UNKNOWN when unknown
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Aug 23 11:42:45 PDT 2023
klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added subscribers: tstellar, jdoerfert.
Herald added a project: All.
klausler requested review of this revision.
For nonexistent or inaccessible files, we're returning NO, which is
indeed true, but we should return UNKNOWN instead.
https://reviews.llvm.org/D158653
Files:
flang/runtime/io-stmt.cpp
Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -1347,13 +1347,16 @@
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158653.552825.patch
Type: text/x-patch
Size: 918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230823/c4ee2409/attachment-0001.bin>
More information about the flang-commits
mailing list