1/* { dg-do run { target tls_runtime } } */ 2/* { dg-options "-O2" } */ 3/* { dg-add-options tls } */ 4 5__thread unsigned char tls_array[64]; 6 7unsigned char 8__attribute__ ((noinline)) 9tls_array_lookup_with_negative_constant(long long int position) { 10 return tls_array[position - 1]; 11} 12 13int 14main () 15{ 16 int i; 17 18 for (i = 0; i < sizeof (tls_array) / sizeof (tls_array[0]); i++) 19 tls_array[i] = i; 20 21 for (i = 0; i < sizeof (tls_array) / sizeof (tls_array[0]); i++) 22 if (i != tls_array_lookup_with_negative_constant (i + 1)) 23 __builtin_abort (); 24 return 0; 25} 26