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.
diff --git a/test/test-pthread.c b/test/test-pthread.c
index fbf397d..c15c876 100644
--- a/test/test-pthread.c
+++ b/test/test-pthread.c
@@ -71,17 +71,17 @@
 int main(int argc,char **argv)
 {
 	pthread_t threads[NTHR];
+	struct thr_arg_s thr_args[NTHR];
 	int i, j;
 
 	printf("Creating %d threads\n",NTHR);
 
 	for(i = 0;i<NTHR;i++)
 	{
-		struct thr_arg_s thr_arg;
 		int result;
-		thr_arg.thr_num=i;
+		thr_args[i].thr_num=i;
 		result = pthread_create(&threads[i],NULL,run_test_in_thread,
-					(void *)&thr_arg);
+					(void *)&thr_args[i]);
 		if(result!=0)
 		{
 			fprintf(stderr,"Cannot create thread %d\n",i);