Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gcc.dg / tls / pic-1.c
blob9108b58aa5034e487ed90e46fae26e70a4c598fe
1 /* { dg-do compile } */
2 /* { dg-require-effective-target fpic } */
3 /* { dg-options "-O2 -fpic -ftls-model=global-dynamic" } */
4 /* { dg-require-effective-target tls } */
6 extern __thread long e1;
7 extern __thread int e2;
8 static __thread long s1;
9 static __thread int s2;
11 long *ae1 (void)
13 return &e1;
16 int *ae2 (void)
18 return &e2;
21 long *as1 (void)
23 return &s1;
26 int *as2 (void)
28 return &s2;
31 long ge1 (void)
33 return e1;
36 int ge2 (void)
38 return e2;
41 long gs1 (void)
43 return s1;
46 int gs2 (void)
48 return s2;
51 long ge3 (void)
53 return e1 + e2;
56 long gs3 (void)
58 return s1 + s2;
61 long ge4 (void)
63 if (0)
64 return e1;
65 return e2;
68 long gs4 (void)
70 if (0)
71 return s1;
72 return s2;