The code below results in an incorrect warning. If the "break" statement is removed, the warning disappears. The C compiler does not issue the warning for both programs.
#include <stdlib.h> // Imports: extern void abort (void) throw () __attribute__ ((__noreturn__)); inline unsigned convert_watch(int w) { switch (w) { case 0: return 0; // Deleting the following line suppresses the warning. break; default: abort(); } } extern void foo(unsigned); void add_fd(int w, int* fdh) { unsigned u = convert_watch(w); // warning: "may reach end..." foo(u); // silence unused warning } -- Summary: Incorrect "may reach end of non-void function" warning Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: minor Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fw at deneb dot enyo dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22435