------- Comment #6 from apl at alum dot mit dot edu 2006-03-28 15:21 ------- I was wrong, this is still broken in GCC 4.0.2 and 4.1.0 although the original test case doesn't demonstrate the bug.
/tools/linux/gcc-4.1.0/bin/g++ -c -Werror -Wall -Wextra b.cxx -O2 cc1plus: warnings being treated as errors b.cxx: In function 'void f()': The slightly simpler test is attached I did debug this in gcc-3.4.3 sources to discover that the problem was in dealing with having set overflow on a complemented constant mask extended from 16 to 32 bits in fold_truthop() inside fold_const.c This code fragment shows where 'integer_zerop() fails because while const_binop() returned a ZERO value, it set the OVERFLOW flag causing the predicate to reject it.... if (! integer_zerop (const_binop (BIT_AND_EXPR, l_const, fold (build1 (BIT_NOT_EXPR, lntype, ll_mask)), 0))) { warning ("comparison is always %d", wanted_code == NE_EXPR); I haven't looked inside the 4.1 sources to establish where the problem is now... -- apl at alum dot mit dot edu changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Known to fail|3.4.3 3.3.3 |3.4.3 3.3.3 4.0.2 4.1.0 Known to work|4.1.0 4.0.0 3.2.3 | Resolution|FIXED | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26729