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