https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85626
Bug ID: 85626
Summary: [nvptx] __builtin_trap should not return
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
As mentioned here ( https://cygwin.com/ml/newlib/2018/msg00335.html ):
...
Then, the nvptx port of gcc implements __builtin_trap using the 'trap' ptx
insn.
The trap insn is documented in the ptx documentation as:
...
Abort execution and generate an interrupt to the host CPU.
...
After consulting with nvidia when running into unexpected behaviour we found
out that in fact the ptx compilers (ptxas and the JIT in the drivers) do not
consider trap a noreturn insn, and that a trap handler may return, and advised
us to add an 'exit' after the trap. I've asked them to improve the ptx
documentation (the abort is somewhat misleading), but sofar no luck there.
So, in fact nvptx __builtin_trap can return, which is a gcc bug, that I still
need to file and fix.
...