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