https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104690
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Couldn't the C front end insert a trap at the end of the function for -O0 compilations? That would at least diagnose this for unoptimized builds. That's what G++ does now.