[flang-commits] [flang] 8ef1075 - [flang][runtime] Signal END from character input

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Jun 15 14:12:49 PDT 2022


Author: Peter Klausler
Date: 2022-06-15T14:12:38-07:00
New Revision: 8ef1075381062d9f2faeb7b9544776a7d9862e5d

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

LOG: [flang][runtime] Signal END from character input

There's code in EditCharacterInput() that causes that template function
to silently return false if it is invoked at the end of the input file.
This overrides other checks that properly call SignalEnd() later.

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

Added: 
    

Modified: 
    flang/runtime/descriptor-io.h
    flang/runtime/edit-input.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/descriptor-io.h b/flang/runtime/descriptor-io.h
index 1ca659a39a53..2fcdc93316a9 100644
--- a/flang/runtime/descriptor-io.h
+++ b/flang/runtime/descriptor-io.h
@@ -176,7 +176,7 @@ inline bool FormattedCharacterIO(
         if (!EditCharacterOutput(io, *edit, x, length)) {
           return false;
         }
-      } else {
+      } else { // input
         if (edit->descriptor != DataEdit::ListDirectedNullValue) {
           if (EditCharacterInput(io, *edit, x, length)) {
             anyInput = true;

diff  --git a/flang/runtime/edit-input.cpp b/flang/runtime/edit-input.cpp
index 57a935fd5765..226bf3570ab3 100644
--- a/flang/runtime/edit-input.cpp
+++ b/flang/runtime/edit-input.cpp
@@ -693,9 +693,6 @@ bool EditCharacterInput(
     return false;
   }
   const ConnectionState &connection{io.GetConnectionState()};
-  if (connection.IsAtEOF()) {
-    return false;
-  }
   std::size_t remaining{length};
   if (edit.width && *edit.width > 0) {
     remaining = *edit.width;


        


More information about the flang-commits mailing list