[Bug target/52268] tls support should be added for darwin11
jeremyhu at macports dot org
gcc-bugzilla@gcc.gnu.org
Mon Jun 30 05:44:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52268
Jeremy Huddleston Sequoia <jeremyhu at macports dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jeremyhu at macports dot org
--- Comment #8 from Jeremy Huddleston Sequoia <jeremyhu at macports dot org> ---
Seems to work to me in gcc-4.6:
~ $ cat test_thread.c
#include <pthread.h>
#include <stdio.h>
#define NUM_THREADS 5
int __thread value;
void * test_thread(void *arg) {
return &value;
}
int main(void) {
int i;
pthread_t thread[NUM_THREADS];
for(i=0; i < 5; i++) {
pthread_create(&thread[i], NULL, test_thread, NULL);
}
for(i=0; i < 5; i++) {
void *loc;
pthread_join(thread[i], &loc);
printf("%p\n", loc);
}
return 0;
}
$ gcc-mp-4.6 test_thread.c
$ ./a.out
0x7fc7b3d00118
0x7fc7b3e00118
0x7fc7b3f00118
0x7fc7b3d00118
0x7fc7b3c03b28
$ gcc-mp-4.6 --version
gcc-mp-4.6 (MacPorts gcc46 4.6.4_5+universal) 4.6.4
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
More information about the Gcc-bugs
mailing list