[Chapel Merge] Fix race causing infinite loop with TaskErrors

Branch: fix-race-taskerrors
Revision: 5bd50a2a79a7ee87bf2d5dad57b0a71d568d36e7
Author: jabraham17
Link: Fix race causing infinite loop with TaskErrors by jabraham17 · Pull Request #29581 · chapel-lang/chapel · GitHub
Log Message:
Fix race causing infinite loop with TaskErrors

Fixes a race condition that could cause the compiler to create a TaskErrors object with a self-referential linked list, which would then be iterated and loop forever (and cause the program to hang).

This could occur because multiple tasks would write to a single task variable (and then read/modify it). Instead, tasks now write to a localize task error variable that is copied out at the end of the task.

[Reviewed by @benharsh]

Compare: Fix race causing infinite loop with TaskErrors by jabraham17 · Pull Request #29581 · chapel-lang/chapel · GitHub

Diff:
M compiler/resolution/lowerIterators.cpp
A test/errhandling/parallel/forall-error-per-task.1-1.good
A test/errhandling/parallel/forall-error-per-task.1-2.good
A test/errhandling/parallel/forall-error-per-task.chpl
A test/errhandling/parallel/forall-error-per-task.execenv
A test/errhandling/parallel/forall-error-per-task.execopts
https://github.com/chapel-lang/chapel/pull/29581.diff