On Thu, Jul 23, 2026 at 12:13:31PM -0700, Andrea Pinski wrote:
> On Thu, Jul 23, 2026 at 12:06 PM John David Anglin <[email protected]> 
> wrote:
> >
> > Tested on hppa64-hp-hpux11.11 with no regressions.
> >
> > Okay?
> 
> Ok.

That is not the only spot that does this though.
I've grepped for printf.*%z and found this.

Ok for trunk if it passes full bootstrap/regtest?

2026-07-23  Jakub Jelinek  <[email protected]>

gcc/
        * sym-exec/sym-exec-expression.cc (symbolic_bit::print): Use
        HOST_SIZE_T_PRINT_UNSIGNED instead of "%zu" and add cast to
        fmt_size_t.
        * genoutput.cc (main): Likewise.
gcc/cobol/
        * symbols.cc (symbols_dump): Use HOST_SIZE_T_PRINT_UNSIGNED instead
        of "%zu" and add cast to fmt_size_t.

--- gcc/sym-exec/sym-exec-expression.cc.jj      2026-03-27 10:17:14.545324032 
+0100
+++ gcc/sym-exec/sym-exec-expression.cc 2026-07-23 21:37:57.087145339 +0200
@@ -400,7 +400,8 @@ symbolic_bit::print ()
   if (dump_file)
     {
       print_generic_expr (dump_file, m_origin, dump_flags);
-      fprintf (dump_file, "[%zu]", m_index);
+      fprintf (dump_file, "[" HOST_SIZE_T_PRINT_UNSIGNED "]",
+              (fmt_size_t) m_index);
     }
 }
 
--- gcc/genoutput.cc.jj 2026-05-30 17:45:09.424109280 +0200
+++ gcc/genoutput.cc    2026-07-23 21:42:55.136292528 +0200
@@ -1176,8 +1176,10 @@ main (int argc, const char **argv)
            max_len = len;
        }
       printf ("void\nverify_reg_names_in_constraints ()\n{\n");
-      printf ("  static const char hregnames[%zu][%zu] = {\n",
-             used_reg_names.elements (), max_len + 1);
+      printf ("  static const char hregnames[" HOST_SIZE_T_PRINT_UNSIGNED "]["
+             HOST_SIZE_T_PRINT_UNSIGNED "] = {\n",
+             (fmt_size_t) used_reg_names.elements (),
+             (fmt_size_t) (max_len + 1));
       auto it = used_reg_names.begin ();
       while (it != used_reg_names.end ())
        {
@@ -1188,8 +1190,8 @@ main (int argc, const char **argv)
          printf ("\n");
        }
       printf ("  };\n");
-      printf ("  for (size_t i = 0; i < %zu; ++i)\n",
-             used_reg_names.elements ());
+      printf ("  for (size_t i = 0; i < " HOST_SIZE_T_PRINT_UNSIGNED
+             "; ++i)\n", (fmt_size_t) used_reg_names.elements ());
       printf ("    if (decode_reg_name (hregnames[i]) < 0)\n");
       printf ("      internal_error (\"invalid register %%qs used in "
              "constraint of machine description\", hregnames[i]);\n");
--- gcc/cobol/symbols.cc.jj     2026-07-23 21:31:51.150920862 +0200
+++ gcc/cobol/symbols.cc        2026-07-23 21:39:06.892238601 +0200
@@ -1150,9 +1150,9 @@ symbols_dump( size_t first, bool header
         auto p = prototype_args(L.name);
         unsigned long narg = p.second? p.first.size() : 0;
         char *base = s;
-        s = xasprintf("%s (%s%zu args)",  base,
+        s = xasprintf("%s (%s" HOST_SIZE_T_PRINT_UNSIGNED " args)",  base,
                       L.prototype? "prototype, " : "",
-                      narg);
+                      (fmt_size_t) narg);
         free(base);
       }
       break;


        Jakub

Reply via email to