[all-commits] [llvm/llvm-project] bf1c89: [flang][runtime] Don't use endfile record number f...

Peter Klausler via All-commits all-commits at lists.llvm.org
Mon Dec 11 12:45:18 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf1c89c3432e74726d49175a34daa2085dc57430
      https://github.com/llvm/llvm-project/commit/bf1c89c3432e74726d49175a34daa2085dc57430
  Author: Peter Klausler <35819229+klausler at users.noreply.github.com>
  Date:   2023-12-11 (Mon, 11 Dec 2023)

  Changed paths:
    M flang/runtime/unit.cpp

  Log Message:
  -----------
  [flang][runtime] Don't use endfile record number for EOF detection on… (#74640)

… input

The current EOF detection method (IsAtEOF()) depends on comparing the
current record number with the record number of the endfile record, if
it is known, which it is for units that have been written and then
rewound for input. For formatted input, this is wrong in the case of a
unit written with in-band newline characters. Rather than scan output
data to count newlines, it's best to just organically determine EOF by
detecting a failed or short read(), as we would have done anyway had the
endfile record number not been known. (I considered resetting the
endfile record number at the point of a REWIND, but not all rewinds are
followed by input; it seems wiser to defer the resetting until an actual
READ takes place.)

Fixes llvm-test-suite/Fortran/gfortran/regression/backslash_2.f90




More information about the All-commits mailing list