Back to index

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