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

--- Comment #5 from Stas Sergeev <stsp at users dot sourceforge.net> ---
(In reply to Jakub Jelinek from comment #4)
> The reason you get an error is that the expression isn't constant, because
> it needs to emit the runtime diagnostics.  Just fix the bug and get away
> with that?  1U<<31 will do.

I of course already "fixed" my code as per
earlier comments here. So you can close this
if you want. But I am sure gcc is not doing
the right thing here. Just make it a warning,
and, more importantly, -W warning, independent
of any -f. Then people will get this warning
with -Wall or whatever, and will not get a
compilation failure with -fsanitize on otherwise
warning-less code.

I am not sure I understand how the run-time
diagnostic makes the expression non-const.

Reply via email to