[Bug c/77292] value range propagation (VRP) would improve -Wlogical-not-parentheses
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 19 11:50:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77292
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #4)
> Note that Clang suggests two ways to silence the warning:
>
> prog.cc:9:10: note: add parentheses after the '!' to evaluate the comparison
> first
> return !a == b;
> ^
> ( )
> prog.cc:9:10: note: add parentheses around left hand side expression to
> silence this warning
> return !a == b;
> ^
> ( )
I guess I should employ here the fix-it feature we now have...
> Also, we do not warn for actual booleans (bool).
This is intentional.
> To be able to not warn based on the runtime range of variables, we would
> need something like VRP in the FE, and that is unlikely to be implemented in
> the medium future.
...if ever.
More information about the Gcc-bugs
mailing list