------- Comment #1 from rguenth at gcc dot gnu dot org 2010-06-13 10:33 ------- It's because
/* Complain if there's just no return statement. */ if (warn_return_type ... /* Normally, with -Wreturn-type, flow will complain, but we might optimize out static functions. */ && !TREE_PUBLIC (fndecl)) so this is very simple detection inside the frontend which is only done for functions with static linkage (to preserve warnings on unused static functions). Elsewhere you'd see "control reaches end of non-void function" instead. So the warning you see is really warning about no return statement, not about control reaching the end of a non-void function. And it does so by design just for functions with static linkage. So I'd say the warning is not false, it is just not useful for the case where the function does not return at all. Leaving the bug as enhancement request instead of closing as wontfix/invalid. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Keywords| |diagnostic http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44511