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

--- Comment #9 from Rich Felker <bugdal at aerifal dot cx> ---
>From a Linux standpoint, there is no trapa trap number defined that would cause
a fatal signal. The ones that are defined are for syscalls and debug
breakpoints. On the other hand, a permanently-undefined opcode would cause
SIGILL. So for Linux targets with aim of generating code that does what you
intend for it to do on both existing and future kernels, I think it makes much
more sense to use FFFD. This also aligns with the behavior of __builtin_trap()
on other targets, which is almost always to execute an instruction that causes
SIGILL (or, if unavailable, SIGSEGV).

I'm not opposed to supporting a -m option to choose a trapa trap instead,
and/or making something with trapa the default for freestanding/non-linux
targets.

FYI this issue is currently a regression that prevents building Linux with
gcc7, since gcc7 introduced an optimization that transforms x/0 to
__builtin_trap() rather than calling the libgcc div function.

Reply via email to