Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gcc4 / gcc / testsuite / gcc.dg / tls / opt-12.c
blob7c6e73430a188057813dabe2a00aa2ddbe9b0f09
1 /* PR target/29198 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -fpic" } */
4 /* { dg-require-effective-target tls_runtime } */
5 /* { dg-require-effective-target fpic } */
7 extern void abort (void);
9 int f2 (int, int, int, int);
10 struct s { char b[4]; };
11 __thread struct s thra[2];
13 void
14 __attribute__((noinline))
15 f1 (int a1, int a2)
17 int i, j;
18 for (i = 0; i < 4; i++)
20 int tot = 0;
21 for (j = 0; j < 4; j++)
22 tot += f2 (a1, a2, i, j);
23 *(&thra[0].b[0] + i) = tot;
27 int
28 __attribute__((noinline))
29 f2 (int a, int b, int c, int d)
31 return a + b + c + d;
34 int
35 main (void)
37 f1 (0, 0);
38 if (thra[0].b[0] != 6
39 || thra[0].b[1] != 10
40 || thra[0].b[2] != 14
41 || thra[0].b[3] != 18)
42 abort ();
43 f1 (2, 3);
44 if (thra[0].b[0] != 26
45 || thra[0].b[1] != 30
46 || thra[0].b[2] != 34
47 || thra[0].b[3] != 38)
48 abort ();
49 return 0;