https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64440
--- Comment #2 from Chengnian Sun <chengniansun at gmail dot com> --- (In reply to Andrew Pinski from comment #1) > In C, const int is not a constant expression and -Wdiv-by-zero only warns > about integer constant expressions. Thanks for your reply. It seems GCC sometimes does consider "const int" for other types of warnings (but not for -Wdiv-by-zero). See the following, with -O3, GCC warns that the left shift count is negative. $: cat t.c int f(int a) { const char c = -4; return a << c; } $: gcc-trunk -Wall -c t.c -O3 t.c: In function âfâ: t.c:3:12: warning: left shift count is negative return a << c; ^ $: