Extend test thread args lifetime
The argument passed to each thread in test-pthread.c indicates a thread number to report when finished. This value is read out by the thread into a local variable early in the thread's execution. Currently, the address passed as this argument is the address of a loop local. However, it is possible that the created thread will not be scheduled to run or will not read the argument before the thread creation loop finishes and the local is destroyed. This can lead to odd behavior, usually observed as multiple threads reporting the same thread_num.
Fix this issue by storing the thread arguments in a parallel array to the array of threads. This ensures that the thread arguments are in scope as long as the threads themselves.
Discovered with tests/test-pthread with AddressSanitizer enabled.