[flang][runtime] Handle endian-swapped record headers & footers on input
authorPeter Klausler <pklausler@nvidia.com>
Thu, 18 Aug 2022 16:52:17 +0000 (09:52 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Thu, 18 Aug 2022 22:36:32 +0000 (15:36 -0700)
commitc7fe5e83dbb4eb164b370546303b111b3a62886d
tree24ddfe06101a70148139ab76bc4edf715989c6cc
parentcc180f4c8cd9a03fe737ed98abb5e54aaacf4ba8
[flang][runtime] Handle endian-swapped record headers & footers on input

The runtime I/O library correctly handles endianness conversions on payload
data I/O and on the output of sequential record headers and footers, but
does not swap endianness when required when reading sequential record headers
and footers back in for READ and BACKSPACE statements.  Mea culpa.  Fix.

Fixes https://github.com/llvm/llvm-project/issues/57126

Differential Revision: https://reviews.llvm.org/D132168
flang/runtime/unit.cpp
flang/runtime/unit.h