]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/gcc.dg/torture/tls/tls-reload-1.c
* gcc.dg/torture/tls/tls-reload-1.c: Add tls options.
[gcc.git] / gcc / testsuite / gcc.dg / torture / tls / tls-reload-1.c
CommitLineData
e0c06fdd
RS
1/* { dg-do run } */
2/* { dg-require-effective-target tls_runtime } */
fc883b84 3/* { dg-add-options tls } */
e0c06fdd
RS
4
5#define ARRAY(X) X##_array
6#define DECLARE(X) \
7 __thread int X; \
8 __thread int ARRAY(X)[4]; \
9 int *volatile *__attribute__((noinline)) \
10 check##X (int *volatile *y) \
11 { \
12 if (!y || *y++ != &X || *y++ != &ARRAY(X)[3]) \
13 return 0; \
14 return y; \
15 }
16#define COPY(X) *y++ = &X; *y++ = &ARRAY(X)[3];
17#define CHECK(X) y = check##X (y);
18#define A(M, X) M(X##0) M(X##1) M(X##2) M(X##3) M(X##4) M(X##5) M(X##6) M(X##7)
19#define B(M, X) A(M, X##0) A(M, X##1) A(M, X##2)
20#define C(M, X) B(M, X) B(M, X) B(M, X)
21
22#define NM 2
23#define NA (NM * 8)
24#define NB (NA * 3)
25#define NC (NB * 3)
26
27extern void abort (void);
28
29B(DECLARE, tls)
30
31void __attribute__ ((noinline))
32setup (int *volatile *y)
33{
34 C(COPY, tls)
35}
36
37int
38main (void)
39{
40 int *volatile array[NC];
41 int *volatile *y = array;
42 int i;
43
44 setup (array);
45 B(CHECK, tls);
46 if (!y)
47 abort ();
48 return 0;
49}
This page took 0.052603 seconds and 5 git commands to generate.