[flang-commits] [PATCH] D127786: [flang][runtime] Signal END from character input

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 14 13:52:37 PDT 2022


klausler created this revision.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
Herald added a project: All.
klausler requested review of this revision.

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.


https://reviews.llvm.org/D127786

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


Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -693,9 +693,6 @@
     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;
Index: flang/runtime/descriptor-io.h
===================================================================
--- flang/runtime/descriptor-io.h
+++ flang/runtime/descriptor-io.h
@@ -176,7 +176,7 @@
         if (!EditCharacterOutput(io, *edit, x, length)) {
           return false;
         }
-      } else {
+      } else { // input
         if (edit->descriptor != DataEdit::ListDirectedNullValue) {
           if (EditCharacterInput(io, *edit, x, length)) {
             anyInput = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127786.436918.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220614/9fdb285b/attachment.bin>


More information about the flang-commits mailing list