1 /* { dg-do run } */ 2 /* { dg-require-effective-target tls_runtime } */ 3 /* { dg-add-options tls } */ 4 5 __extension__ typedef __SIZE_TYPE__ size_t; 6 7 extern void abort (void); 8 extern void *memset (void *, int, size_t); 9 10 struct A 11 { 12 char pad[48]; 13 int i; 14 int pad2; 15 int j; 16 }; 17 __thread struct A a; 18 19 int * 20 __attribute__((noinline)) foo(void)21foo (void) 22 { 23 return &a.i; 24 } 25 26 int main(void)27main (void) 28 { 29 int *p = foo (); 30 memset (&a, 0, sizeof (a)); 31 a.i = 6; 32 a.j = 8; 33 if (p[0] != 6 || p[1] != 0 || p[2] != 8) 34 abort (); 35 return 0; 36 } 37