New Issue: [Bug]: Potential race in list.toArray

28202, "jabraham17", "[Bug]: Potential race in list.toArray", "2025-12-13T00:02:47Z"

While looking at the list.toArray code today, I found a potential race when parSafe=true

proc toArray() {
  var result: [0..#_size] eltType; // unguarded access of _size
  on this {
    _enter(); // lock
    var tmp: [0..#_size] eltType = forall i in 0..#_size do _getRef(i);
    result = tmp;
    _leave(); // unlock
  }
  return result;
}

We allocate the array of _size unguarded. Then enter the critical section, re-read size and allocate another array and assign it to the first. If the size of the list changes between when its read to create the result and when its read to create the tmp, there will be a mismatched array assignment.