Debian Codegraph @

gcc/testsuite/objc.dg/torture/tls/thr-init-2.m

raw
1 // { dg-do run }
2 // { dg-require-effective-target tls_runtime }
3 // { dg-add-options tls }
4
5 extern void _exit(int);
6
7 __thread int glb =1 ;
8
9 static __thread int fstat = 2;
10
11 int fa(int a)
12 {
13 static __thread int as = 3;
14 as += a ;
15 return as;
16 }
17
18 int fb(int b)
19 {
20 static __thread int bs = 4;
21 bs += b ;
22 glb = bs;
23 return bs;
24 }
25
26 int main (int ac, char *av[])
27 {
28 int a = 1;
29
30 a = fa(fstat);
31 if ( a != 5 )
32 _exit (-(__LINE__)) ;
33
34 a = fa(glb);
35 if ( a != 6 )
36 _exit (-(__LINE__)) ;
37
38 a = fb(a);
39 if ( a != 10 || glb != 10 )
40 _exit (-(__LINE__)) ;
41
42 return 0;
43 }