This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/77292] value range propagation (VRP) would improve -Wlogical-not-parentheses
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Aug 2016 11:50:29 +0000
- Subject: [Bug c/77292] value range propagation (VRP) would improve -Wlogical-not-parentheses
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
- References: <bug-77292-4@http.gcc.gnu.org/bugzilla/>
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.