Commit 51baf85a by Nathan Sidwell Committed by Nathan Sidwell

nvptx.c (nvptx_output_call_insn): Emit trap after no return call.

	gcc/
	* config/nvptx/nvptx.c (nvptx_output_call_insn): Emit trap after no
	return call.

	gcc/testsuite/
	* gcc.target/nvptx/abort.c: New.

From-SVN: r231368
parent f79520bb
2015-12-07 Nathan Sidwell <nathan@acm.org>
* config/nvptx/nvptx.c (nvptx_output_call_insn): Emit trap after no
return call.
2015-12-07 David Malcolm <dmalcolm@redhat.com>
* pretty-print.c (text_info::set_range): Rename to...
......@@ -1890,6 +1890,13 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee)
}
fprintf (asm_out_file, ";\n");
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");
return result != NULL_RTX ? "\tld.param%t0\t%0, [%%retval_in];\n\t}" : "}";
}
......
2015-12-07 Nathan Sidwell <nathan@acm.org>
* gcc.target/nvptx/abort.c: New.
2015-12-07 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/diagnostic-ranges-1.c: New test file.
......
/* { dg-do compile} */
/* Annotate no return functions with a trailing 'trap'. */
extern void abort ();
int main (int argc, char **argv)
{
if (argc > 2)
abort ();
return 0;
}
/* { dg-final { scan-assembler "call abort;\[\r\n\t \]+trap;" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment