On Fri, May 04, 2018 at 09:46:45AM +0200, Tom de Vries wrote:
> 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):

Please say what has changed in the ChangeLog entry.
Otherwise LGTM.

>  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);


        Jakub

Reply via email to