Hi!
GCC with enabled algol68 fails to build on i686-linux, the error is
../../gcc/algol68/a68-low-multiples.cc:636:31: error: format ‘%ld’ expects
argument of type ‘long int’, but argument 2 has type ‘size_t’ {aka ‘unsigned
int’} [-Werror=format=]
xasprintf is printf family, so it can't use %zd portably, so the
following patch uses what is used elsewhere, the HOST_SIZE_T_PRINT*
macros with (fmt_size_t) cast - the macros pick the smallest of
%d, %ld and %lld depending on SIZE_MAX, but it could still disagree
on the exact type and cause warnings or for hosts with say 24-bit
size_t it could be even larger, so the cast is needed to handle that.
Bootstrapped/regtested on i686-linux, the only failures are:
FAIL: algol68/execute/widening-bits-2.a68 execution test, *
FAIL: algol68/execute/widening-bits-3.a68 execution test, *
(where by * I mean it fails at any optimization level).
Ok for trunk?
BTW, I see the algol68 commits had ChangeLog entries in commit
messages, but they were added to toplevel ChangeLog and gcc/ChangeLog.
That is caused by 2 things:
1) contrib/gcc-changelog/gcc_commit.py (default_changelog_locations)
wasn't updated, if you want gcc/algol68/ChangeLog and
libga68/ChangeLog, then it needs to be updated
2) almost empty ChangeLog files need to be checked in (with the last
few lines in only - copyright, and in your case moving there
stuff from gcc/ChangeLog and libga68/ChangeLog)
3) so that patches are precommit verified, the 1) change needs
to be propagated to gccadmin's checked out copy
2025-12-01 Jakub Jelinek <[email protected]>
PR algol68/122926
* a68-low-multiples.cc (copy_multiple_dimension_elems): Use
HOST_SIZE_T_PRINT_DEC in xasprintf format string and cast to
fmt_size_t.
--- gcc/algol68/a68-low-multiples.cc.jj 2025-11-30 21:49:44.136503080 +0100
+++ gcc/algol68/a68-low-multiples.cc 2025-12-01 00:34:18.147460525 +0100
@@ -633,7 +633,7 @@ copy_multiple_dimension_elems (size_t di
tree element_type = TREE_TYPE (element_pointer_type);
tree upb = a68_multiple_upper_bound (from, size_int (dim));
- char *name = xasprintf ("r%ld%%", dim);
+ char *name = xasprintf ("r" HOST_SIZE_T_PRINT_DEC "%%", (fmt_size_t) dim);
indexes[dim] = a68_lower_tmpvar (name, ssizetype,
a68_multiple_lower_bound (from,
size_int (dim)));
Jakub