[flang-commits] [flang] 398dffd - [flang] Fix INQUIRE(FILE=, NAME=)

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Tue Dec 7 08:17:19 PST 2021


Author: Peter Klausler
Date: 2021-12-07T08:17:08-08:00
New Revision: 398dffd4ffc7cbc320e15207c8c04ca682d821c4

URL: https://github.com/llvm/llvm-project/commit/398dffd4ffc7cbc320e15207c8c04ca682d821c4
DIFF: https://github.com/llvm/llvm-project/commit/398dffd4ffc7cbc320e15207c8c04ca682d821c4.diff

LOG: [flang] Fix INQUIRE(FILE=,NAME=)

The file name output was not being copied back to the program
from the runtime.

Differential Revision: https://reviews.llvm.org/D115190

Added: 
    

Modified: 
    flang/runtime/io-stmt.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp
index f92b4bb02e8b0..e4aed8d0c724f 100644
--- a/flang/runtime/io-stmt.cpp
+++ b/flang/runtime/io-stmt.cpp
@@ -1202,7 +1202,10 @@ bool InquireUnconnectedFileState::Inquire(
     break;
   case HashInquiryKeyword("NAME"):
     str = path_.get();
-    return true;
+    if (!str) {
+      return true; // result is undefined
+    }
+    break;
   }
   if (str) {
     ToFortranDefaultCharacter(result, length, str);


        


More information about the flang-commits mailing list