https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89232
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- The reason you get a warning from cc (and clang) is that your function sometimes returns, which would lead to undefined behaviour. You are misusing noreturn. The noreturn specifier/attribute means the function *never* returns, it is not to be used for functions which *sometimes* don't return. Any function is allowed to call exit(), you're not supposed to mark such functions noreturn. The C11 standard says: A function declared with a _Noreturn function specifier shall not return to its caller. Recommended practice The implementation should produce a diagnostic message for a function declared with a _Noreturn function specifier that appears to be capable of returning to its caller.