blob: fc067707283d2a83e7f7f0c65c2c162d552f73e5 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#include "tst-tls10.h"
2
3#ifdef USE_TLS__THREAD
4__thread int dummy __attribute__((visibility ("hidden"))) = 12;
5__thread struct A local = { 1, 2, 3 };
6#endif
7
8#define CHECK(N, S) \
9 p = f##N##a (); \
10 if (p->a != S || p->b != S + 1 || p->c != S + 2) \
11 abort ()
12
13int
14main (void)
15{
16 struct A *p;
17 if (local.a != 1 || local.b != 2 || local.c != 3)
18 abort ();
19#ifdef USE_TLS__THREAD
20 if (a1.a != 4 || a1.b != 5 || a1.c != 6)
21 abort ();
22 if (a2.a != 22 || a2.b != 23 || a2.c != 24)
23 abort ();
24 if (a3.a != 10 || a3.b != 11 || a3.c != 12)
25 abort ();
26 if (a4.a != 25 || a4.b != 26 || a4.c != 27)
27 abort ();
28 check1 ();
29 check2 ();
30 if (f1a () != &a1 || f2a () != &a2 || f3a () != &a3 || f4a () != &a4)
31 abort ();
32 CHECK (5, 16);
33 CHECK (6, 19);
34 if (f7a () != &a2 || f8a () != &a4)
35 abort ();
36 CHECK (9, 28);
37 CHECK (10, 31);
38#endif
39 exit (0);
40}