Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / g++.dg / tls / thread_local3.C
blobe05a0b95306777c6b52f4cc279c2e504b49bb941
1 // { dg-do run }
2 // { dg-require-effective-target c++11 }
3 // { dg-require-effective-target tls_runtime }
4 // { dg-require-effective-target pthread }
5 // { dg-options -pthread }
6 // { dg-add-options tls }
8 int c;
9 int d;
10 struct A
12   A() { ++c; }
13   ~A() { ++d; }
16 void f()
18   thread_local A a;
21 void *thread_main(void *)
23   f(); f(); f();
26 #include <pthread.h>
28 int main()
30   pthread_t thread;
31   pthread_create (&thread, 0, thread_main, 0);
32   pthread_join(thread, 0);
33   pthread_create (&thread, 0, thread_main, 0);
34   pthread_join(thread, 0);
36   if (c != 2 || d != 2)
37     __builtin_abort();