llvm-project
f49c4dc1 - [flang] Fix REAL(10) Read() endianness for big-endian hosts (#234842)

Commit
3 days ago
[flang] Fix REAL(10) Read() endianness for big-endian hosts (#234842) On big-endian hosts (e.g. AIX), for REAL(10), the 80-bit value sits in the low-order bytes of the `uint128_t`. `X87IntegerContainer` stores its 16-bit parts from byte 0, so only the top 32 bits of the value were read, into the low bits of the word. The result was always a subnormal (or zero) with the sign lost, instead of the correct value. Build Word from lo/hi `uint64_t` halves via the `Integer<>` integer constructor, which uses `SetLEPart()` and is endian-portable. Also remove the AIX_WARNING test expectations, which only reflected the bug. https://github.com/llvm/llvm-project/pull/216958 exposes this bug and cause the following failures on AIX: ``` Failed Tests (3): flang-Unit :: Evaluate/./FlangEvaluateTests/RealValueKind/RealValueKind/AsFortran/REAL_10 flang-Unit :: Evaluate/./FlangEvaluateTests/RealValueKind/RealValueKind/FromIntegerPowersOfTwo/REAL_10 flang-Unit :: Evaluate/./FlangEvaluateTests/RealValueKind/RealValueKind/Read/REAL_10 ``` https://lab.llvm.org/buildbot/#/builders/231/builds/2026 Assisted-by: IBM Bob --------- Co-authored-by: Hubert Tong <hubert.reinterpretcast@gmail.com> Co-authored-by: Eugene Epshteyn <eepshteyn@nvidia.com>
Author
Parents
Loading