-Wall produces warning on second function, not on slightly simpler first function.
struct C { C() { } ~C() {} }; int fine(int p) { C c; if (p) { if (p == 4) { return 1; } else { return 2; } } else { return 3; } } int foul(int p) { C c; int pcopy = p; if (pcopy && p) { if (p == 4) { return 1; } else { return 2; } } else { return 3; } } Probably a duplicate of 20624 or so. I can't access newer version right now. Occurs in 4.0.1, 4.0.0, not in 3.4.5 -- Summary: Wrong warning: control reaches end of non-void function Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ssomers at opnet dot com GCC host triplet: sparc-sun-solaris2.8 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25973