Back to index

glibc  2.9
tst-tlsmod17a.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 
00003 #ifndef N
00004 #define N 0
00005 #endif
00006 #define CONCAT1(s, n) s##n
00007 #define CONCAT(s, n) CONCAT1(s, n)
00008 
00009 __thread int CONCAT (v, N) = 4;
00010 
00011 int
00012 CONCAT (tlsmod17a, N) (void)
00013 {
00014   int *p = &CONCAT (v, N);
00015   /* GCC assumes &var is never NULL, add optimization barrier.  */
00016   asm volatile ("" : "+r" (p));
00017   if (p == NULL || *p != 4)
00018     {
00019       printf ("fail %d %p\n", N, p);
00020       return 1;
00021     }
00022   return 0;
00023 }