On 04/30/2015 07:17 AM, Marek Polacek wrote:
The problem here was that the -Wbool-compare warning about always false/true
comparisons with 0/1 was assuming that both operands are of a boolean type.
That was wrong so check for that, but don't get confused about bools promoted
to int.
This bug is blocking aarch64 bootstrap, so I'm taking the liberty of committing
it right away.
Bootstrapped/regtested on x86_64-linux, applying to trunk.
2015-04-30 Marek Polacek <pola...@redhat.com>
* c-common.c (maybe_warn_bool_compare): When comparing with 0/1,
require that the non-constant be of a boolean type.
* c-c++-common/Wbool-compare-3.c: New test.
OK.
BTW, you may also want to consider warning for integer types with a
precision of 1 bit.
Jeff