Debian Codegraph @

gcc/testsuite/gcc.dg/tls/struct-1.c

raw
1 /* This testcase ICEd on IA-32 because the backend was inconsistent whether
2 to allow addends for @dtpoff relocs or not. */
3 /* { dg-do compile } */
4 /* { dg-require-effective-target fpic } */
5 /* { dg-options "-O2 -fpic" } */
6 /* { dg-require-effective-target tls } */
7
8 struct S {
9 int s0, s1, s2, s3;
10 };
11 static __thread struct S x;
12 extern void abort (void);
13 extern void exit (int);
14
15 void
16 foo (struct S *s)
17 {
18 s->s2 = 231;
19 }
20
21 void
22 bar (void)
23 {
24 if (x.s0 == 231 || x.s2 != 231)
25 abort ();
26 }
27
28 int
29 main ()
30 {
31 foo (&x);
32 bar ();
33 exit (0);
34 }