https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70800
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to David Binderman from comment #6) > (In reply to Eric Gallager from comment #5) > > > keeping bug open for the enhancement to -Wtautological-compare > > I tried out the code in comment 1 on recent gcc trunk > and the problem seems to be fixed: > > Alphasrc $ ~/gcc/results/bin/g++ -c -g -O2 -Wall jan22a.cc > jan22a.cc: In function ‘void f(int)’: > jan22a.cc:6:24: warning: bitwise comparison always evaluates to false > [-Wtautological-compare] > 6 | if ((n & 0x30) == 1) > | ~~~~~~~~~~ ^~ ~ > Alphasrc $ The warning started to show up in GCC 8 for the reduced testcase in comment #1. But the reduced testcase is different from the original code so ... This will be the one for the missing warning: extern void g(int n); void f( unsigned long x) { if (((x) & 0xFFFFul) > 999999ul) g( x); }