PR target/24475
[official-gcc.git] / gcc / testsuite / gcc.dg / tls / opt-11.c
blob3739645257ab02e0fff6b4b3ebbbe33cbf6f0ead
1 /* { dg-do run } */
2 /* { dg-require-effective-target tls_runtime } */
4 extern void abort (void);
5 extern void *memset (void *, int, __SIZE_TYPE__);
7 struct A
9 char pad[48];
10 int i;
11 int pad2;
12 int j;
14 __thread struct A a;
16 int *
17 __attribute__((noinline))
18 foo (void)
20 return &a.i;
23 int
24 main (void)
26 int *p = foo ();
27 memset (&a, 0, sizeof (a));
28 a.i = 6;
29 a.j = 8;
30 if (p[0] != 6 || p[1] != 0 || p[2] != 8)
31 abort ();
32 return 0;