[COMMITTED] a68: fix imports in big-endian targets [PR algol68/123132]

Jose E. Marchesi jose.marchesi@oracle.com
Wed Dec 17 18:39:59 GMT 2025


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 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/gcc/algol68/a68-imports.cc b/gcc/algol68/a68-imports.cc
index 9b367dac4c5..c628d21f581 100644
--- a/gcc/algol68/a68-imports.cc
+++ b/gcc/algol68/a68-imports.cc
@@ -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								\
 	{								\
-- 
2.30.2



More information about the Algol68 mailing list