http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54979
Bug #: 54979 Summary: no warning for useless comparison Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: tro...@gcc.gnu.org gdb had code similar to this: int comp(int x, int y) { return x > x ? 1 : 0; } The comparison here is useless; what was meant was "x > y". clang detects this: a.c:3:12: warning: self-comparison always evaluates to false [-Wtautological-compare] return x > x ? 1 : 0; ^ ... but I couldn't find a gcc warning for this.