the task construct accepts a lastprivate or reduction clause:
Variables used as loop iteration variables in sequential loops in a parallel
construct or a task construct may be listed in private, firstprivate,
lastprivate, shared, or reduction clauses on the parallel or task
construct, and on enclosed constructs, subject to other restrictions.