aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/nvptx/nvptx.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/nvptx/nvptx.c')
-rw-r--r--gcc/config/nvptx/nvptx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index b088cf8..a6c90b6 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/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);
}