[Bug c++/60664] bool / out of range int comparison warning failure
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Oct 13 08:49:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60664
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |WAITING
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to David Binderman from comment #3)
> $ fgrep "Wtautological-constant-out-of-range-compare" mk.out
> ../../src/trunk/gcc/expr.c:5230:9: warning: comparison of constant -1 with
> expression of type 'unsigned int' is always false
> [-Wtautological-constant-out-of-range-compare]
> $
>
> if (!SUBREG_CHECK_PROMOTED_SIGN (target,
> TYPE_UNSIGNED (TREE_TYPE (exp))))
> {
>
Actually, recent gcc/g++ both warn for your testcase in comment #1:
/home/manuel/test.c:7:12: warning: comparison of constant ‘2’ with boolean
expression is always false [-Wbool-compare]
if (f(a) == 2)
^
David, would you mind testing with a recent revision? In those cases where
Clang warns and GCC doesn't, could you figure out a minimal testcase? Thanks!
More information about the Gcc-bugs
mailing list