[Bug c/63357] New: Warn for P && P and P || P
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Sep 24 10:26:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357
Bug ID: 63357
Summary: Warn for P && P and P || P
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
We probably should warn about (both C/C++):
int
foo (int a, int b)
{
if (a && a)
return 1;
if (b || b)
return 2;
if (!a && !a)
return 3;
if (!b || !b)
return 4;
return 0;
}
See https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02080.html
I suggest this be called -Wredundant-op. Better names?
More information about the Gcc-bugs
mailing list