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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
With -fno-builtin, mimimized further to:
...
char buffer[100];

int
main (void)
{
  unsigned int i = 0xdeadbeef;

  __builtin_sprintf (buffer, "%hhx", i);
  __builtin_printf ("%s\n", buffer);

  __builtin_printf ("%hhx\n", i);

  return 0;
}
...

On x86_64 with glibc:
...
$ gcc gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf.c
$ ./a.out
ef
ef
...

On nvptx with newlib:
...
spawn nvptx-none-run ./builtin-sprintf.exe^M
beef^M
%hhx^M
...

This could be related to newlib support for hh, I'll try to rebuild with
--enable-newlib-io-c99-formats.

Reply via email to