1 #include <stdio.h>
2 
3 #ifndef N
4 #define N 0
5 #endif
6 #define CONCAT1(s, n) s##n
7 #define CONCAT(s, n) CONCAT1(s, n)
8 
9 __thread int CONCAT (v, N) = 4;
10 
11 int
CONCAT(tlsmod17a,N)12 CONCAT (tlsmod17a, N) (void)
13 {
14   int *p = &CONCAT (v, N);
15   /* GCC assumes &var is never NULL, add optimization barrier.  */
16   __asm__ __volatile__ ("" : "+r" (p));
17   if (p == NULL || *p != 4)
18     {
19       printf ("fail %d %p\n", N, p);
20       return 1;
21     }
22   return 0;
23 }
24