This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/71926] New: wrong -Wparentheses warning
- From: "izaberina at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 19 Jul 2016 04:01:58 +0000
- Subject: [Bug c/71926] New: wrong -Wparentheses warning
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71926
Bug ID: 71926
Summary: wrong -Wparentheses warning
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: izaberina at gmail dot com
Target Milestone: ---
int main() {
int a = 1, b = 2, c = 3, d = 4;
if (a = 2 || (b != 3 &&
c != 4 && d != 5)) return 1;
return 0;
}
-Wparentheses produces the following warning:
gccfail.c:4:23: warning: suggest parentheses around assignment used as truth
value [-Wparentheses]
c != 4 && d != 5)) return 1;
^
gcc found the problem, but the warning is pretty misleading: i was about to
ignore it because it looked like a bogus warning