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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
            Summary|Spurious                    |Spurious
                   |-Wmissing-format-attribute  |-Wmissing-format-attribute
                   |warning in 32-bit mode      |and missing -Wformat for
                   |                            |va_list in 32-bit mode
      Known to fail|                            |7.3.0, 8.2.0, 9.0

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
The same problem also results in a missing -Wformat for the following test
case:

  #include <stdarg.h>

  void f (va_list va)
  {
    __builtin_printf ("%s", va);
  }

It's only diagnosed without -m32:

$ gcc -S -Wall -Wmissing-format-attribute t.c
t.c: In function ‘f’:
t.c:5:23: warning: format ‘%s’ expects argument of type ‘char *’, but argument
2 has type ‘__va_list_tag *’ [-Wformat=]
    5 |   __builtin_printf ("%s", va);
      |                      ~^   ~~
      |                       |   |
      |                       |   __va_list_tag *
      |                       char *


One way to deal with it would be compare the name of the type of the argument
to "va_list"  Another might be to treat __builtin_va_list as a type distinct
from char* when it's defined to be char*.

Reply via email to