On some archs, C[TL]Z_DEFINED_VALUE_AT_ZERO macros return only true/false, so -Wbool-compare would warn. But on e.g. mips or aarch64 they might yield 2. This patch casts the value to int to quash that warning. Dropping the "== 2" would be prettier, but I don't want to break other archs. The point is that -Wbool-compare should be enabled by -Wall, and this is the last thing that prevents it.
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2014-08-19 Marek Polacek <pola...@redhat.com> * optabs.c (expand_ffs): Cast C[TL]Z_DEFINED_VALUE_AT_ZERO macros to int. diff --git gcc/optabs.c gcc/optabs.c index 60228d3..26b5603 100644 --- gcc/optabs.c +++ gcc/optabs.c @@ -2827,7 +2827,7 @@ expand_ffs (enum machine_mode mode, rtx op0, rtx target) if (!temp) goto fail; - defined_at_zero = (CTZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2); + defined_at_zero = ((int) CTZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2); } else if (optab_handler (clz_optab, mode) != CODE_FOR_nothing) { @@ -2836,7 +2836,7 @@ expand_ffs (enum machine_mode mode, rtx op0, rtx target) if (!temp) goto fail; - if (CLZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2) + if ((int) CLZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2) { defined_at_zero = true; val = (GET_MODE_PRECISION (mode) - 1) - val; Marek