https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71852
Bug ID: 71852 Summary: add warning for conditions that can never be true Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tromey at gcc dot gnu.org Target Milestone: --- Consider this code, derived from some code in gdb's arm-tdep.c: int main(int argc, char**argv) { unsigned int aa = argc; aa = aa & 0x04; if (aa == 0x00) { // Ok. } else if (aa == 0x01) { // Ok. } else if (aa == 0x0b) { // Oops. } } Here, two of the conditions can never be true. I think it would be nice if gcc could warn for this case.