This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GCC 6] [PR target/70860] [nvptx] Handle NULL cfun in nvptx_libcall_value


Hi!

On Thu, 28 Apr 2016 12:26:24 +0200, I wrote:
> Richard's r235511 changes (quoted below) cause certain nvptx offloading
> test cases to run into SIGSEGVs:

With these changes recently having been ported to gcc-6-branch in
r236210, these failures/regressions now also show up there:

>     [...]
>     #4  0x0000000000d14193 in nvptx_libcall_value (mode=mode@entry=SImode)
>         at [...]/source-gcc/gcc/config/nvptx/nvptx.c:489
>     #5  0x0000000000d17a20 in nvptx_function_value (type=0x7fc1fa359690, func=0x0, outgoing=<optimized out>)
>         at [...]/source-gcc/gcc/config/nvptx/nvptx.c:512
>     #6  0x00000000006ba220 in hard_function_value (valtype=valtype@entry=0x7fc1fa359690, func=func@entry=0x0, fntype=fntype@entry=0x0, 
>         outgoing=outgoing@entry=0) at [...]/source-gcc/gcc/explow.c:1860
>     #7  0x000000000073b0fa in aggregate_value_p (exp=exp@entry=0x7fc1fa41a048, fntype=0x0)
>         at [...]/source-gcc/gcc/function.c:2086
>     #8  0x0000000000bebc11 in find_func_aliases_for_call (t=0x1feac90, fn=0x7ffe448ca8a0)
>         at [...]/source-gcc/gcc/tree-ssa-structalias.c:4644
>     #9  find_func_aliases (fn=fn@entry=0x7fc1fa43a540, origt=origt@entry=0x7fc1fa43a7e0)
>         at [...]/source-gcc/gcc/tree-ssa-structalias.c:4737
>     #10 0x0000000000bf04eb in ipa_pta_execute ()
>         at [...]/source-gcc/gcc/tree-ssa-structalias.c:7787
>     #11 (anonymous namespace)::pass_ipa_pta::execute (this=<optimized out>)
>         at [...]/source-gcc/gcc/tree-ssa-structalias.c:8035
>     #12 0x0000000000940bed in execute_one_pass (pass=pass@entry=0x1f43770)
>         at [...]/source-gcc/gcc/passes.c:2348
>     #13 0x0000000000941972 in execute_ipa_pass_list (pass=0x1f43770)
>         at [...]/source-gcc/gcc/passes.c:2778
>     #14 0x0000000000607f1f in symbol_table::compile (this=0x7fc1fa359000)
>         at [...]/source-gcc/gcc/cgraphunit.c:2435
>     #15 0x000000000056ad48 in lto_main () at [...]/source-gcc/gcc/lto/lto.c:3328
>     #16 0x0000000000a065df in compile_file () at [...]/source-gcc/gcc/toplev.c:474
>     #17 0x000000000053753a in do_compile () at [...]/source-gcc/gcc/toplev.c:1998
>     #18 toplev::main (this=this@entry=0x7ffe448caba0, argc=argc@entry=18, argv=0x1f1eec0, argv@entry=0x7ffe448caca8)
>         at [...]/source-gcc/gcc/toplev.c:2106
>     #19 0x00000000005391d7 in main (argc=18, argv=0x7ffe448caca8)
>         at [...]/source-gcc/gcc/main.c:39

As obvious, backported my trunk r235748 to gcc-6-branch in r236326:

commit 75737dcecabcfd43fe3a3fa7a0c4d3d215dcdee7
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Tue May 17 16:08:37 2016 +0000

    [PR target/70860] [nvptx] Handle NULL cfun in nvptx_libcall_value
    
    Backport GCC trunk r235748:
    
    	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/branches/gcc-6-branch@236326 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog            | 7 +++++++
 gcc/config/nvptx/nvptx.c | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git gcc/ChangeLog gcc/ChangeLog
index ea107f7..8fd7f61 100644
--- gcc/ChangeLog
+++ gcc/ChangeLog
@@ -1,3 +1,10 @@
+2016-05-17  Thomas Schwinge  <thomas@codesourcery.com>
+
+	Backport trunk r235748:
+	PR target/70860
+	* config/nvptx/nvptx.c (nvptx_libcall_value): Handle NULL cfun.
+	(nvptx_function_value): Assert non-NULL cfun.
+
 2016-05-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
 	Backport from mainline
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

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]