]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
a68: fix imports in big-endian targets [PR algol68/123132]
authorJose E. Marchesi <jose.marchesi@oracle.com>
Wed, 17 Dec 2025 17:03:15 +0000 (18:03 +0100)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Wed, 17 Dec 2025 17:26:16 +0000 (18:26 +0100)
This commit fixes the macro DOFFSET in big-endian targets.
Tested in sparc64-linux-gnu in both -m64 and -m32.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>
gcc/algol68/ChangeLog

PR algol68/123132
* a68-imports.cc (DOFFSET): Fix big-endian path.

gcc/algol68/a68-imports.cc

index 9b367dac4c51e079b1f6942bda5576bbd9b747db..c628d21f581952cec8d1bbe64a36748cf8356370 100644 (file)
@@ -495,11 +495,10 @@ a68_get_packet_exports (const std::string &filename,
       if (pos + PTR_SIZE > size)                                       \
        goto decode_error;                                              \
       (V) = 0;                                                         \
-      uint64_t ptr_bit_size = 8 * PTR_SIZE;                            \
       if (BYTES_BIG_ENDIAN)                                            \
        {                                                               \
          for (int i = 0; i < PTR_SIZE; i++)                            \
-           (V) = ((V) | ((uint8_t) data[pos + i] << (ptr_bit_size - (i * 8)))); \
+           (V) = ((V) | ((uint8_t) data[pos + i] << ((PTR_SIZE - i - 1) * 8))); \
        }                                                               \
       else                                                             \
        {                                                               \