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: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 28 Jul 2017 20:13:23 +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
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
CC| |egallager at gcc dot gnu.org
Summary|No -Wbool-compare warning |No -Wbool-compare warning
|on "(a = 0 && 0) <= 4" and |on "(a = 0 && 0) <= 4"
|"0 > a < 0" |
--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Chengnian Sun from comment #2)
> Another test case.
>
>
> $: cat s.c
> int a;
> void f() {
> (0 > a < 0);
> }
> $:
> $: gcc-trunk -Wbool-compare -Wtype-limits -c s.c
> $:
This one warns for me:
$ /usr/local/bin/gcc -c -Wparentheses -Wbool-compare -Wbool-operation
-Wtautological-compare -Wint-in-bool-context -Wtype-limits 64609.c
64609.c: In function ‘f’:
64609.c:4:9: warning: comparison of constant ‘0’ with boolean expression is
always false [-Wbool-compare]
(0 > a < 0);
^
64609.c:4:5: warning: comparisons like ‘X<=Y<=Z’ do not have their mathematical
meaning [-Wparentheses]
(0 > a < 0);
~~^~~
$
The first one still doesn't warn though. Retitling to just be about the first
one.