https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108435

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think the problem is that normally when gimplifying
OMP_CLAUSE_LASTPRIVATE_STMT we force a BIND_EXPR around it:
              push_gimplify_context ();
              if (TREE_CODE (OMP_CLAUSE_LASTPRIVATE_STMT (c)) != BIND_EXPR)
                {
                  tree bind = build3 (BIND_EXPR, void_type_node, NULL,
                                      NULL, NULL);
                  TREE_SIDE_EFFECTS (bind) = 1;
                  BIND_EXPR_BODY (bind) = OMP_CLAUSE_LASTPRIVATE_STMT (c);
                  OMP_CLAUSE_LASTPRIVATE_STMT (c) = bind;
                }
              gimplify_and_add (OMP_CLAUSE_LASTPRIVATE_STMT (c),
                                &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
              pop_gimplify_context
                (gimple_seq_first_stmt (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ
(c)));
(similarly for linear), but in this case we do it only conditionally - if
temporaries are needed:
                if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE)
                  seq = &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c);
                else
                  seq = &OMP_CLAUSE_LINEAR_GIMPLE_SEQ (c);
                push_gimplify_context ();
                gimplify_assign (decl, t, seq);
                gimple *bind = NULL;
                if (gimplify_ctxp->temps)
                  {
                    bind = gimple_build_bind (NULL_TREE, *seq, NULL_TREE);
                    *seq = NULL;
                    gimplify_seq_add_stmt (seq, bind);
                  }
                pop_gimplify_context (bind);
So, either we do it also unconditionally during gimplify.cc, or in
tree-nested.cc add it later.

Reply via email to