https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80547
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vries at gcc dot gnu.org
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Thomas Schwinge from comment #0)
> Created attachment 41280 [details]
> r.c
>
> As far as I remember, it is permissible to directly write into an
> OpenACC/OpenMP reduction variable ("x = [...]", as opposed to modifying it
> with some binary operator: "x = x OP [...]"). Looking at the attached test
> case (greatly reduced from another test case), that works (and returns the
> expected result) for the OpenMP code therein, but runs into a nvptx back end
> ICE for OpenACC, if optimizations "-O" are enabled:
>
Using this tentative patch, the ICE is fixed and the test-case executes
successfully:
...
@@ -5354,7 +5361,8 @@ nvptx_goacc_reduction_init (gcall *call)
init = var;
}
- gimplify_assign (lhs, init, &seq);
+ if (lhs)
+ gimplify_assign (lhs, init, &seq);
}
pop_gimplify_context (NULL);
...