[all-commits] [llvm/llvm-project] 5da55b: [flang] Fix output buffering bug (positionability ...

Peter Klausler via All-commits all-commits at lists.llvm.org
Wed Mar 24 11:39:42 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5da55bfc18f64b7171be150913e2f5eac6e0f184
      https://github.com/llvm/llvm-project/commit/5da55bfc18f64b7171be150913e2f5eac6e0f184
  Author: peter klausler <pklausler at nvidia.com>
  Date:   2021-03-24 (Wed, 24 Mar 2021)

  Changed paths:
    M flang/runtime/buffer.h
    M flang/unittests/Runtime/CMakeLists.txt
    A flang/unittests/Runtime/buffer.cpp

  Log Message:
  -----------
  [flang] Fix output buffering bug (positionability assumption)

The I/O runtime library code was failing to retain data in a buffer
from the current output record when flushing the buffer; this is
fatally wrong when the corresponding file cannot be repositioned,
as in the case of standard output to the console. So refine the
Flush() member function to retain a specified number of bytes,
rearrange the data as necessary (using existing code for read frame
management after moving it into a new member function), and add
a big comment to the head of the file to clarify the roles of the
various data members in the management of contiguous frames in
circular buffers.

Update: added a unit test.

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




More information about the All-commits mailing list