[Bug c++/104642] Add __builtin_trap() for missing return at -O0

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 3 17:08:03 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104642

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> Not sure, people will still see the surprising behavior at -O1+ then

Sure, but we can justify that as optimizing away the checks. But giving a
predictable crash at -O0 and confusing nonsense at -O1+ is easier to debug than
confusing nonsense at all levels.


> I'd rather have -funreachable-traps or so, enabled by default at -O0, rather
> than special-casing the return case btw.

That would be even better, yes.


More information about the Gcc-bugs mailing list