[gcc r16-5788] a68: Fix algol68 build on i686-linux
Jakub Jelinek
jakub@gcc.gnu.org
Mon Dec 1 09:46:31 GMT 2025
https://gcc.gnu.org/g:e69bea9b4ccfe79efeec6e87d7d24e6350f31375
commit r16-5788-ge69bea9b4ccfe79efeec6e87d7d24e6350f31375
Author: Jakub Jelinek <jakub@redhat.com>
Date: Mon Dec 1 10:44:48 2025 +0100
a68: Fix algol68 build on i686-linux
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.
2025-12-01 Jakub Jelinek <jakub@redhat.com>
* algol68/a68-low-multiples.cc (copy_multiple_dimension_elems): Use
HOST_SIZE_T_PRINT_DEC in xasprintf format string and cast to
fmt_size_t.
Diff:
---
gcc/algol68/a68-low-multiples.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/algol68/a68-low-multiples.cc b/gcc/algol68/a68-low-multiples.cc
index ce5996c9249a..572162e30aca 100644
--- a/gcc/algol68/a68-low-multiples.cc
+++ b/gcc/algol68/a68-low-multiples.cc
@@ -633,7 +633,7 @@ copy_multiple_dimension_elems (size_t dim, size_t num_dimensions,
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)));
More information about the Gcc-cvs
mailing list