http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47864
Summary: incorrect control reaches end of non-void function (switch+break+default) Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: a...@fischman.org Using -finstrument-functions together with a switch statement containing a "break;" can result in incorrect warning about reaching the end of a non-void function, even when the "break;" is a no-op (because it follows an unconditional return statement). $ nl t.cc ; g++ -finstrument-functions -Wreturn-type -Werror -c t.cc 1 int foo(int type) { 2 switch(type) { 3 case 0: return 1; break; 4 default: return 0; 5 } 6 } cc1plus: warnings being treated as errors t.cc: In function ‘int foo(int)’: t.cc:6: error: control reaches end of non-void function This is with: $ gcc --version gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 Doing either of: - remove the "break;" - build without -finstrument-functions makes gcc stop emitting the incorrect warning.