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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-04-01
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  When making the promotion explicit (switch ((int)x))) we reject the
testcase:

> gcc t.c -Wall -S
t.c: In function ‘f’:
t.c:7:5: error: duplicate case value
     case 0xffffffff: X=0xffffffff; break;
     ^
t.c:6:5: error: previously used here
     case -1: X=-1; break;
     ^

and GCC 8 warns:

> gcc-8 t.c -Wall -S
t.c: In function ‘f’:
t.c:6:5: warning: case label value is less than minimum value for type
     case -1: X=-1; break;
     ^~~~
t.c:7:5: warning: case label value is less than minimum value for type
     case 0xffffffff: X=0xffffffff; break;
     ^~~~
t.c:6:15: warning: statement will never be executed [-Wswitch-unreachable]
     case -1: X=-1; break;
              ~^~~

Reply via email to