https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56281
--- Comment #6 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Jakub Jelinek from comment #1)
> Given the amount of code in the wild that assumes 1 << 31 etc. work, I think
> it would be a bad idea to try to optimize this for C99, especially when it
> is now considered valid for C++.
Anyway, this is documented in the GCC manual:
As an extension to the C language, GCC does not use the latitude
given in C99 and C11 only to treat certain aspects of signed ‘<<’
as undefined.
(quoted from the GCC 13.2.0 manual).
So perhaps there should be an option to allow GCC to optimize this case.