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

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Here's a slightly different but arguably even more compelling test case from
x86_64-linux with ILP32 where wchar_t is a typedef for long for some strange
reason yet wint_t is a typedef for int.  Passing a wchar_t argument to a %lc
directive (as I suspect is not uncommon) produces a -Wformat warning and the
hint suggests replacing %lc with %ld, which is almost certainly not correct.

$ cat t.c && gcc -S -Wall -m32 t.c
typedef __WCHAR_TYPE__ wchar_t;

void f (const wchar_t *ws)
{
  __builtin_printf ("%lc", *ws);
}
t.c: In function ‘f’:
t.c:5:24: warning: format ‘%lc’ expects argument of type ‘wint_t’, but argument
2 has type ‘wchar_t {aka const long int}’ [-Wformat=]
   __builtin_printf ("%lc", *ws);
                      ~~^   ~~~
                      %ld

Reply via email to