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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-10-01
     Ever confirmed|0                           |1

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Confirmed, probably because optimization lets gcc take advantage of knowledge
that f1 doesn't actually use its parameter:

$ /usr/local/bin/gcc -c -Wall -Wextra -O1 80147.c
80147.c: In function ‘f1’:
80147.c:2:21: warning: unused parameter ‘i’ [-Wunused-parameter]
 static void f1 (int i) { }
                     ^
80147.c: In function ‘g’:
80147.c:8:2: warning: ‘i1’ is used uninitialized in this function
[-Wuninitialized]
  f1 (i1);
  ^~~~~~~
80147.c:9:2: warning: ‘i2’ is used uninitialized in this function
[-Wuninitialized]
  f2 (i2);
  ^~~~~~~
80147.c:3:26: warning: ‘j2’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
 static void f2 (int i) { f0 (i); }
                          ^~~~~~
80147.c:7:18: note: ‘j2’ was declared here
  int i1, i2, j1, j2;
                  ^~
$

...but if that's the case, then why doesn't the warning go away for i1, too?

Reply via email to