https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110073

--- Comment #1 from David Faust <david.faust at oracle dot com> ---
Created attachment 55234
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55234&action=edit
alternate proposed patch

Thank you for catching this, and for the fix!

With the proposed patch on linux x86_64 I see the following:

../../../gcc/gcc/btfout.cc: In function ‘void
btf_asm_func_type(ctf_container_ref, ctf_dtdef_ref, size_t)’:
../../../gcc/gcc/btfout.cc:952:31: warning: format ‘%u’ expects argument of
type ‘unsigned int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’}
[-Wformat=]
  952 |                        "TYPE %u BTF_KIND_FUNC '%s'",
      |                              ~^
      |                               |
      |                               unsigned int
      |                              %lu
  953 |                        num_types_added + num_vars_added + 1 + i,
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                             |
      |                                                             size_t {aka
long unsigned int}

I believe %zu instead of %u should work.

Alternatively, a small refactor to the offending code makes it behave in line
with the other functions (to properly use a ctf_id_t, and then PRIu64 as in
your patch). But I haven't verified this on solaris/x86 yet.

Reply via email to