https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106548
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The problem is the following code in omp-low.c:
do_firstprivate:
lower_private_allocate (var, new_var, allocator, allocate_ptr,
ilist, ctx, false, NULL_TREE);
x = build_outer_var_ref (var, ctx);
if (is_simd)
{
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LINEAR
&& gimple_omp_for_combined_into_p (ctx->stmt))
{
tree t = OMP_CLAUSE_LINEAR_STEP (c);
where the clause ('c') is
<omp_clause 0x7ffff71432d0 linear
op-0: <parm_decl 0x7ffff7ffb100 i> ( == var)
op-1: <parm_decl 0x7ffff7ffb180 k>
and 't' is
<parm_decl 0x7ffff7ffb180 k
I think something like the following is needed:
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -6190,2 +6190,6 @@ lower_rec_input_clausesgimple_seq *dlist,
tree t = OMP_CLAUSE_LINEAR_STEP (c);
+ if (VAR_P (t)
+ || TREE_CODE (t) == PARM_DECL
+ || TREE_CODE (t) == RESULT_DECL)
+ t = build_outer_var_ref (t, ctx);
tree stept = TREE_TYPE (t);