[flang][runtime] Fix recently broken big-endian formatted integer input (#135417)

My recent change to speed up formatted integer input has a bug on
big-endian targets that has shown up on ppc64 AIX build bots. Fix.
This commit is contained in:
Peter Klausler 2025-04-11 12:52:23 -07:00 committed by GitHub
parent a45b133d40
commit 72144d119a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -293,8 +293,8 @@ RT_API_ATTRS bool EditIntegerInput(IoStatementState &io, const DataEdit &edit,
#if USING_NATIVE_INT128_T
auto shft{static_cast<int>(sizeof value - kind)};
if (!isHostLittleEndian && shft >= 0) {
auto l{value << shft};
std::memcpy(n, &l, kind);
auto shifted{value << (8 * shft)};
std::memcpy(n, &shifted, kind);
} else {
std::memcpy(n, &value, kind); // a blank field means zero
}