[flang][runtime] Signal END from character input
authorPeter Klausler <pklausler@nvidia.com>
Fri, 10 Jun 2022 16:33:44 +0000 (09:33 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Wed, 15 Jun 2022 21:12:38 +0000 (14:12 -0700)
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

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

index 1ca659a..2fcdc93 100644 (file)
@@ -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;
index 57a935f..226bf35 100644 (file)
@@ -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;