[ was: Re: [PATCH, PR82428] Add
__builtin_goacc_{gang,worker,vector}_{id,size} ]
On 01/18/2018 09:55 AM, Tom de Vries wrote:
On 01/17/2018 06:51 PM, Jakub Jelinek wrote:
On Wed, Jan 17, 2018 at 06:42:33PM +0100, Tom de Vries wrote:
@@ -6602,6 +6604,71 @@ expand_stack_save (void)
return ret;
}
+/* Emit code to get the openacc gang, worker or vector id or size. */
+
+static rtx
+expand_builtin_goacc_parlevel_id_size (tree exp, rtx target, int ignore)
+{
<SNIP>
+
+ if (ignore)
+ return target;
+
+ if (!targetm.have_oacc_dim_size ())
+ {
+ emit_move_insn (target, fallback_retval);
+ return target;
+ }
+
Hi,
As reported in PR85639 (triggered on powerpc64), this function causes a
segfault when called with ignore == 0 and target == NULL_RTX, by calling
emit_move_insn with target == NULL_RTX.
Fixed by making sure target is non-null before calling emit_move_insn.
Rebuild cc1 on powerpc64, and verified that:
- the segfault no longer happens, and
- valid RTL code is generated for the __builtin_goacc_parlevel_id call
that caused the ICE.
OK for trunk?
Thanks,
- Tom
[expand] Handle null target in expand_builtin_goacc_parlevel_id_size
2018-05-04 Tom de Vries <t...@codesourcery.com>
PR libgomp/85639
* builtins.c (expand_builtin_goacc_parlevel_id_size):
---
gcc/builtins.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 300e13c..0097d5b 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -6682,6 +6682,9 @@ expand_builtin_goacc_parlevel_id_size (tree exp, rtx target, int ignore)
if (ignore)
return target;
+ if (target == NULL_RTX)
+ target = gen_reg_rtx (TYPE_MODE (TREE_TYPE (exp)));
+
if (!targetm.have_oacc_dim_size ())
{
emit_move_insn (target, fallback_retval);