https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111400
--- Comment #2 from David Brown <david at westcontrol dot com> --- (In reply to Richard Biener from comment #1) > Confirmed. Note C17 disallows a return wotihout an expression for a funcion > that returns a value, not sure if that means falling off the function > without a return (value) is still OK, it at least feels inconsistent. This has all remained unchanged from C99 to C23 (draft), I believe, which makes things easier! As far as I can tell, the relevant point in the standards is 6.9.1p12, "Function definitions", which says "Unless otherwise specified, if the } that terminates a function is reached, and the value of the function call is used by the caller, the behaviour is undefined". So while a non-void function cannot have a return statement without an expression (6.8.6.4p1), control flow /can/ run off the terminating }. I think this is perhaps a concession to older pre-void C code, when a function that does not have a return value would still be declared to return "int". Thus I think gcc's lack of a sanitizer here is technically accurate - but not helpful, unless you are working with 35 year old code!