Please do not reply directly to this email. All additional comments should be made in the comments box of this bug.
https://bugzilla.redhat.com/show_bug.cgi?id=115157
geir@cray.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |geir@cray.com
--- Comment #15 from geir@cray.com 2009-02-03 17:50:31 EDT --- FYI: I find that the problem fails on a SLES 9.2 system, but works on a SLES 9.3 system:
SLES 9.2 failing:
$ cat /etc/SuSE-release SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 2 $ cat test2.c #include <stdio.h> #include <stdlib.h> #include <pthread.h>
void * thread_sub (void *p) { int *i;
i = (int *) p; printf("Hello, world, I am thread %d\n", *i); fflush(stdout); pthread_exit(NULL); }
int main(int argc, char *argv[]) { pthread_t *threads; int *ind; int err; int i; int tcount = 0; void *status;
if (argc < 2) { fprintf(stderr, "ERROR: must specify number of threads\n"); exit(1); }
tcount = atoi(argv[1]); fprintf(stderr, "INFO: tcount = %d\n", tcount);
if (tcount <= 0) { fprintf(stderr, "ERROR: thread count must be > 0\n"); }
threads = malloc(sizeof(pthread_t) * tcount); if (threads == NULL) { fprintf(stderr, "ERROR: cannot malloc threads array\n"); exit (2); }
ind = malloc(sizeof(int) * tcount); if (ind == NULL) { fprintf(stderr, "ERROR: cannot malloc ind array\n"); exit (2); }
for (i = 1; i < tcount; i++) { ind[i] = i; fprintf(stderr, "INFO: start thread %d\n", i); err = 0; err = pthread_create (&threads[i], NULL, thread_sub, (void *) &ind[i]); if (err) { fprintf(stderr, "ERROR: pthread_create %d, err=%d\n", i, err); exit(3+i); } } ind[0] = 0; thread_sub(&ind[0]);
for (i=1; i < tcount; i++) { err = pthread_join(threads[i], &status); if (err) { fprintf(stderr, "ERROR: pthread_join %d, err=%d\n", i, err); exit(10+i); } fprintf(stderr, "INFO: joined thread %d\n", i); } exit(0); } $ gcc -static test2.c -I /usr/include/nptl -L/usr/lib64/nptl -lpthread $ ./a.out 4 Memory fault $
Here is a SLES 9.3 system working:
$ cat /etc/SuSE-release SUSE LINUX Enterprise Server 9 (x86_64) VERSION = 9 PATCHLEVEL = 3 $ gcc -static test2.c -I /usr/include/nptl -L/usr/lib64/nptl -lpthread $ ./a.out 4 INFO: tcount = 4 INFO: start thread 1 INFO: start thread 2 INFO: start thread 3 Hello, world, I am thread 2 Hello, world, I am thread 1 Hello, world, I am thread 0 Hello, world, I am thread 3 $
triage@lists.fedoraproject.org