| 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 |
|
| 7 |
unsigned char |
| 8 |
__attribute__ ((noinline)) |
| 9 |
tls_array_lookup_with_negative_constant(long long int position) { |
| 10 |
return tls_array[position - 1]; |
| 11 |
} |
| 12 |
|
| 13 |
int |
| 14 |
main () |
| 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 |
} |