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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>  It should say something about undefined behaviour instead.

The problem is for integer constants, it is not undefined at runtime but rather
invalid code at compile time.

>Should there also be a warning for the other use of 1 << 31?

I think you misunderstood the warning/error fully.

In C99-C17, 1<<31 is not an integer constant expression as there is an
overflow. 

But it is still valid, just undefined at runtime if used where an integer
constant expression is not required. case statements require an integer
constant expression.

Reply via email to