[flang] Fix regression from recent runtime input fix
authorpeter klausler <pklausler@nvidia.com>
Mon, 16 Aug 2021 20:15:01 +0000 (13:15 -0700)
committerpeter klausler <pklausler@nvidia.com>
Tue, 17 Aug 2021 17:12:56 +0000 (10:12 -0700)
commitdfea011a37797f77ef526880694254cb6e655a8e
treeade92dbe2aee32bff2dc22cda097412052fb7a0e
parentfb81271e8b44cafff3abf4c05d1485d4b4832e6e
[flang] Fix regression from recent runtime input fix

A recent runtime I/O change[1] was meant to improve the handling of
input from external files missing a terminal newline on their last
records; the change was "triggered" by the wrong circumstances and
causing reads that should have pulled more data into the buffer to be
treated as EOFs.  So fix that, and also don't retain input data
in the buffer once an input record has been finished unless it's
known that list-directed or NAMELIST input of a repeated input item
may need to backspace a non-positionable external unit to return
to the beginning of the repeated item.

[1] 6578893a0453384346f149479f8574dfff977ace

Differential Revision: https://reviews.llvm.org/D108164
flang/runtime/connection.h
flang/runtime/io-stmt.cpp
flang/runtime/io-stmt.h
flang/runtime/unit.cpp