[Bug c++/109364] Missing return statement in a non void function gives only a warning but produces a forced crash.
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 31 22:37:50 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109364
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
As I will mention it again falling through from a function which has a non void
return type is undefined. So gcc thinks it is unreachable. With the option is
specify in comment #2, gcc 13 will cause a trap (usually an illegal instruction
but could be an abort call).
So there is nothing to change about gcc. Undefined code means just that if you
invoke undefined code, anything can happen.
More information about the Gcc-bugs
mailing list