This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/64609] No -Wbool-compare warning on "(a = 0 && 0) <= 4"
- 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: Wed, 16 Aug 2017 11:20:02 +0000
- Subject: [Bug c/64609] No -Wbool-compare warning on "(a = 0 && 0) <= 4"
- Auto-submitted: auto-generated
- References: <bug-64609-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64609
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
It's because we get rid of that && 0 prior calling maybe_warn_bool_compare.
But we warn for
int
fn1 (int a, int b)
{
return ((a && b) <= 4);
}
warning: comparison of constant ‘4’ with boolean expression is always true