This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/51896] Should gcc warn if a variable initializer inside a switch statement is never used?


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51896

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-19
     Ever Confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-19 10:04:01 UTC ---
Confirmed.  This is similar to

int 
main(int argc, char *argv[])
{
  goto _default;
    {
      int *b = (int*)0xbbbbbbbb;

      _default:
      printf("b is: %p\n", b);
    }

  return 0;
}

thus, when you jump across an init expression and still use the variable.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]