http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49409
Summary: some possible new warnings for strange code Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: dcb...@hotmail.com Consider the following code extern void g( int); void f( int i) { if (i == i) // same thing compared g( i); if (i != i) // same thing compared g( 2 * i); if ((i - i) > 10) // X - X == 0, unless volatile g( 3 * i); if (i || i) // duplicates in || g( 4 * i); if (i && i) // duplicates in && g( 5 * i); } I ran the above code through the C++ compiler, with warning flags -Wall -Wextra and it was surprisingly silent. Would it be worthwhile for g++ to warn about some, all or none of the above coding errors ?