aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2016-05-02 13:25:17 +0200
committerThomas Schwinge <tschwinge@gcc.gnu.org>2016-05-02 13:25:17 +0200
commite91cacaedb0ef7c9674af7f8920de5952bbb7fbb (patch)
treef6f32bb7c89b7af952b468d97d16ba021ad5bb98 /gcc
parentc408fb34f9068cf559e8065b60fdf44450377a67 (diff)
downloadgcc-e91cacaedb0ef7c9674af7f8920de5952bbb7fbb.zip
gcc-e91cacaedb0ef7c9674af7f8920de5952bbb7fbb.tar.gz
gcc-e91cacaedb0ef7c9674af7f8920de5952bbb7fbb.tar.bz2
[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. From-SVN: r235748
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/nvptx/nvptx.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 49a314a..f344e0f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-05-02 Thomas Schwinge <thomas@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 <ebotcazou@adacore.com>
PR rtl-optimization/70886
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);
}