[COMMITTED] a68: complete_encoded_mode: union packs are stored in reversed order

Jose E. Marchesi jemarch@gnu.org
Thu Nov 20 22:30:21 GMT 2025


---
 gcc/algol68/a68-imports.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/algol68/a68-imports.cc b/gcc/algol68/a68-imports.cc
index a52740d0a78..55fdfb6ac22 100644
--- a/gcc/algol68/a68-imports.cc
+++ b/gcc/algol68/a68-imports.cc
@@ -674,9 +674,9 @@ complete_encoded_mode (encoded_modes_map_t &encoded_modes, uint64_t offset)
       pack = NO_PACK;
       for (uint8_t i = 0; i < em->data.union_.nmodes; i++)
 	{
-	  /* Note we have to do this from last united mode to first united
-	     mode, because a68_add_mode_to_pack prepends to the list.  */
-	  uint16_t index = em->data.union_.nmodes - 1 - i;
+	  /* Union alternatives are internally stored in reverse order in the
+	     pack.  */
+	  uint16_t index = i;
 	  MOID_T *united_moid = complete_encoded_mode (encoded_modes,
 						       em->data.union_.modes[index]);
 	  if (united_moid == NO_MOID)
-- 
2.30.2



More information about the Algol68 mailing list