[Bug c/77292] value range propagation (VRP) would improve -Wlogical-not-parentheses
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 19 11:46:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77292
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |SUSPENDED
Last reconfirmed| |2016-08-19
CC| |manu at gcc dot gnu.org
Summary|Spurious "warning: logical |value range propagation
|not is only applied to the |(VRP) would improve
|left hand side of |-Wlogical-not-parentheses
|comparison" |
Ever confirmed|0 |1
--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
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;
^
( )
Also, we do not warn for actual booleans (bool).
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.
More information about the Gcc-bugs
mailing list