[Bug target/80035] [nvptx] non-returning function call causes ptxas sigsegv

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 13 20:32:00 GMT 2017


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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tschwinge at gcc dot gnu.org

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
> 	{
> 		.param.u32 %out_arg1;
> 		st.param.u32 [%out_arg1], %r31;
> 		call exit, (%out_arg1);
> 		trap; // (noreturn)
>	}

At nvptx_output_call_insn, we see:
...
  if (find_reg_note (insn, REG_NORETURN, NULL))
    /* No return functions confuse the PTX JIT, as it doesn't realize           
       the flow control barrier they imply.  It can seg fault if it             
       encounters what looks like an unexitable loop.  Emit a trailing          
       trap, which it does grok.  */
    fprintf (asm_out_file, "\t\ttrap; // (noreturn)\n");
...

Replacing trap with exit or ret (or adding it after trap), makes the sigsegv go
away.


More information about the Gcc-bugs mailing list