https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110718
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2026-06-12
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
In GCC, the assignment happens in omp-low.cc's lower_omp_for_lastprivate
/* Initialize the iterator variable, so that threads that don't execute
any iterations don't execute the lastprivate clauses by accident. */
gimplify_assign (fd->loop.v, vinit, body_p);
Looks as if for loop.v != OMP_FOR_ORIG_DECLS, an additional assignment is
required - albeit the original decl does not seem to be available here,
anymore.
The 'i = i.2' is added in gimplify.cc.
TODO: When modifying this, check that it also works when combined with loop
transformations.