[Bug tree-optimization/84595] __builtin_trap() causes optimizer to remove code

danielgutson at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 27 16:50:00 GMT 2018


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

--- Comment #5 from Daniel Gutson <danielgutson at gmail dot com> ---
(In reply to Andrew Pinski from comment #4)
> (In reply to Daniel Gutson from comment #3)
> > OK. That was my second suggested alternative.
> > BTW I didn't see __builtin_trap documented as noreturn in the documentation.
> 
> Depends on the reading of __builtin_trap documentation.
> My reading says it does not return.
> 
> "This function causes the program to exit abnormally.  GCC implements this
> function by using a target-dependent mechanism (such as intentionally
> executing an illegal instruction) or by calling abort."
> 
> Since the documentation talks about calling abort, I would assume
> __built_trap should be treated almost the same as calling abort.

OK. I'll leave this issue as a feature request for __builtin_break(). Maybe the
component should be changed to something more appropriate?


More information about the Gcc-bugs mailing list