https://gcc.gnu.org/g:3ed55c5ee90e0cdb2e2edc7aa4976f5cea7bd5ec
commit r17-1822-g3ed55c5ee90e0cdb2e2edc7aa4976f5cea7bd5ec Author: Jose E. Marchesi <[email protected]> Date: Wed Jun 24 23:57:38 2026 +0200 a68: fix comparison of pack element names in packs_ordering Entry names of packs (struct fields, union alternatives, procedure parameter list) cannot be compared purely by pointer value. This patch fixes the union alternative sorting code to not rely on this false assumption. Signed-off-by: Jose E. Marchesi <[email protected]> gcc/algol68/ChangeLog * a68-moids-sorting.cc (packs_ordering): Do not rely on pointer comparison when comparing pack element names. Diff: --- gcc/algol68/a68-moids-sorting.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/algol68/a68-moids-sorting.cc b/gcc/algol68/a68-moids-sorting.cc index 6579fbd2cc1e..53c3487fb281 100644 --- a/gcc/algol68/a68-moids-sorting.cc +++ b/gcc/algol68/a68-moids-sorting.cc @@ -52,7 +52,10 @@ packs_ordering (PACK_T *a, PACK_T *b, bool compare_names = true) return 1; if (TEXT (b) == NO_TEXT) return -1; - return -strcmp (TEXT (a), TEXT (b)); + + int cmp = strcmp (TEXT (a), TEXT (b)); + if (cmp != 0) + return -cmp; } } }
