[flang-commits] [flang] [Flang] Shift the data from lower to higher order bits in the big endian environment (PR #73670)

via flang-commits flang-commits at lists.llvm.org
Tue Dec 12 12:52:07 PST 2023


================
@@ -222,7 +222,15 @@ bool EditIntegerInput(
     value = -value;
   }
   if (any || !io.GetConnectionState().IsAtEOF()) {
-    std::memcpy(n, &value, kind); // a blank field means zero
+    // For integer kind <= 4, the value is stored in the lower order bits on
----------------
kkwli wrote:

@klausler I am not sure perhaps I miss something. In here, it wants to memcpy any size less than that of `uint64_t`, the memory layout is different within the components of `Int128`, i.e. the value is in the lower order bits in BE. Swapping the order of `high` and `low` will not make things different about the layout within the 8 byte storage. The existing code assumes that the value is always in the high order bit in `low`.

https://github.com/llvm/llvm-project/pull/73670


More information about the flang-commits mailing list