https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89056
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Yes, it allows it. It's undefined behaviour for your code to reach the end of the function (because there's no return statement) so the compiler assumes that the function will never reach that point. That means the loop must keep going (only exiting if one of the expressions in the loop throws an exception). If that's what you intended, then you can mark the function with the noreturn attribute to inform the compiler of your intention, or you can explicitly add __builtin_unreachable() at the end of the function. Either of those will suppress the warning. Of course that's not what you intended here, so you should heed the warning and fix the code.