http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60442
Bug ID: 60442 Summary: No -Wparentheses warning for "if (a += b)" Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com The gcc trunk emits -Wparentheses warnings for "if(a = b)" and "if(a = a + b)", but not "if(a += b)" $: cat s.c int b; int f(int a) { if (a = b) return 0; else if (a = a + b) return 3; else if (a += b) /* <- no warning here*/ return 2; else return 1; } $: gcc-trunk -Wparentheses -c s.c s.c: In function âfâ: s.c:3:3: warning: suggest parentheses around assignment used as truth value [-Wparentheses] if (a = b) ^ s.c:5:3: warning: suggest parentheses around assignment used as truth value [-Wparentheses] else if (a = a + b) ^ $: