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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2020-11-17 00:00:00         |2021-4-9
            Summary|Bogus warnings about        |avoid mentioning va_list
                   |va_list                     |internal fields in
                   |                            |-Wuninitialized
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #12 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #7)
> Thanks, my original intention was to mostly track the fact that we do not
> want
> to warn about fields of va_list type that is internal to compiler though
> :)

To be clear: for the following test case you suggest to issue just the one
warning below:

$ cat pr97858.c && gcc -O2  -S -Wall pr97858.c
void f (__builtin_va_list);

int g (int i, ...)
{
  __builtin_va_list ap;
  // __builtin_va_start (ap, i);

  int x = __builtin_va_arg (ap, int);
  __builtin_va_end (ap);

  return x;
}
pr97858.c: In function ‘g’:
pr97858.c:8:7: warning: ‘ap’ is used uninitialized [-Wuninitialized]
    8 |   int x = __builtin_va_arg (ap, int);
      |       ^
pr97858.c:5:21: note: ‘ap’ declared here
    5 |   __builtin_va_list ap;
      |                     ^~

as opposed to the three GCC issues now:

pr97858.c: In function ‘g’:
pr97858.c:8:7: warning: ‘ap[0].gp_offset’ is used uninitialized
[-Wuninitialized]
    8 |   int x = __builtin_va_arg (ap, int);
      |       ^
pr97858.c:5:21: note: ‘ap’ declared here
    5 |   __builtin_va_list ap;
      |                     ^~
pr97858.c:8:7: warning: ‘ap[0].reg_save_area’ may be used uninitialized
[-Wmaybe-uninitialized]
    8 |   int x = __builtin_va_arg (ap, int);
      |       ^
pr97858.c:5:21: note: ‘ap’ declared here
    5 |   __builtin_va_list ap;
      |                     ^~
pr97858.c:8:7: warning: ‘ap[0].overflow_arg_area’ may be used uninitialized
[-Wmaybe-uninitialized]
    8 |   int x = __builtin_va_arg (ap, int);
      |       ^
pr97858.c:5:21: note: ‘ap’ declared here
    5 |   __builtin_va_list ap;
      |                     ^~

Reply via email to