https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-08-19
CC| |manu at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
The reason for the error is that -fsanitize=undefined replaces 1<<31 with a
call to a sanitizer function __ubsan_handle_shift_out_of_bounds(), however,
this function call is not constant and it cannot be the initializer of a static
variable.
A possible solution could be to give a warning enabled by default (about 1 <<
31 being undefined) and to NOT sanitize expressions that are required to be
constants (since anyway the compiler will not accept them).
In any case, it makes sense that -fsanitize=undefined does not affect whether
the code is compiled or not.