[flang-commits] [flang] a5f5d72 - [flang][runtime] When NAMELIST input hits EOF, signal END, not an error

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Thu Oct 6 11:32:47 PDT 2022


Author: Peter Klausler
Date: 2022-10-06T11:30:56-07:00
New Revision: a5f5d72f6c01eb02549af636939c3831d038359e

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

LOG: [flang][runtime] When NAMELIST input hits EOF, signal END, not an error

NAMELIST input processing in the runtime support library treats an
end-of-file found while searching for the initial '&' character
as an error condition, but it really should be distinguishable.
Call SignalEnd() rather than SignalError().

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

Added: 
    

Modified: 
    flang/runtime/namelist.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/namelist.cpp b/flang/runtime/namelist.cpp
index 460a4c9c71755..125b8509c631f 100644
--- a/flang/runtime/namelist.cpp
+++ b/flang/runtime/namelist.cpp
@@ -383,7 +383,11 @@ bool IONAME(InputNamelist)(Cookie cookie, const NamelistGroup &group) {
         next = io.GetNextNonBlank(byteCount);
       }
     }
-    if (!next || *next != '&') {
+    if (!next) {
+      handler.SignalEnd();
+      return false;
+    }
+    if (*next != '&') {
       handler.SignalError(
           "NAMELIST input group does not begin with '&' (at '%lc')", *next);
       return false;


        


More information about the flang-commits mailing list