Hi! On Thu, 28 Apr 2016 13:42:39 +0200, Bernd Schmidt <bschm...@redhat.com> wrote: > On 04/28/2016 01:15 PM, Alexander Monakov wrote: > > So if my understanding is correct, additional !cfun check can be acceptable > > as > > a fix along the existing hack. Perhaps with a note about the nature of the > > hack. > > Yes, I think Thomas' patch is ok.
Thanks for the review of the patch as well as the existing code; I filed <http://gcc.gnu.org/PR70860> "[nvptx] Revisit cfun->machine->doing_call". To resolve the immediate problem, I committed to trunk in r235748: commit 5fbb617747498ce3b0fd97aaa5334611e6220263 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Mon May 2 11:25:17 2016 +0000 [PR target/70860] [nvptx] Handle NULL cfun in nvptx_libcall_value gcc/ PR target/70860 * config/nvptx/nvptx.c (nvptx_libcall_value): Handle NULL cfun. (nvptx_function_value): Assert non-NULL cfun. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235748 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/nvptx/nvptx.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git gcc/ChangeLog gcc/ChangeLog index 49a314a..f344e0f 100644 --- gcc/ChangeLog +++ gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-05-02 Thomas Schwinge <tho...@codesourcery.com> + + PR target/70860 + * config/nvptx/nvptx.c (nvptx_libcall_value): Handle NULL cfun. + (nvptx_function_value): Assert non-NULL cfun. + 2016-05-02 Eric Botcazou <ebotca...@adacore.com> PR rtl-optimization/70886 diff --git gcc/config/nvptx/nvptx.c gcc/config/nvptx/nvptx.c index b088cf8..a6c90b6 100644 --- gcc/config/nvptx/nvptx.c +++ gcc/config/nvptx/nvptx.c @@ -483,7 +483,7 @@ nvptx_strict_argument_naming (cumulative_args_t cum_v) static rtx nvptx_libcall_value (machine_mode mode, const_rtx) { - if (!cfun->machine->doing_call) + if (!cfun || !cfun->machine->doing_call) /* Pretend to return in a hard reg for early uses before pseudos can be generated. */ return gen_rtx_REG (mode, NVPTX_RETURN_REGNUM); @@ -502,6 +502,7 @@ nvptx_function_value (const_tree type, const_tree ARG_UNUSED (func), if (outgoing) { + gcc_assert (cfun); cfun->machine->return_mode = mode; return gen_rtx_REG (mode, NVPTX_RETURN_REGNUM); } Grüße Thomas