http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60725
Bug ID: 60725 Summary: [-Wreturn-type] false positive in trivial switch Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: skvadrik at gmail dot com Created attachment 32510 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32510&action=edit wreturn_false_positive.c Given this program (see attachment): // wreturn_false_positive.c enum E { E1 }; static inline int f1(enum E e) { switch (e) { case E1: return 1; } } int main () { f1(E1); return 0; } gcc generates warning: $ gcc -Wall wreturn_false_positive.c wreturn_false_positive.c: In function ‘f1’: wreturn_false_positive.c:9:1: warning: control reaches end of non-void function [-Wreturn-type] If I compile with '-fdump-tree-all', I see that gcc adds 'default' case to switch very early (in .gimple), and later it cannot get rid of that 'default' path. Why does gcc add default case?