Skip to content

Commit 72144d1

Browse files
authored
[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.
1 parent a45b133 commit 72144d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

flang-rt/lib/runtime/edit-input.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ RT_API_ATTRS bool EditIntegerInput(IoStatementState &io, const DataEdit &edit,
293293
#if USING_NATIVE_INT128_T
294294
auto shft{static_cast<int>(sizeof value - kind)};
295295
if (!isHostLittleEndian && shft >= 0) {
296-
auto l{value << shft};
297-
std::memcpy(n, &l, kind);
296+
auto shifted{value << (8 * shft)};
297+
std::memcpy(n, &shifted, kind);
298298
} else {
299299
std::memcpy(n, &value, kind); // a blank field means zero
300300
}

0 commit comments

Comments
 (0)