aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pr54445-1.c
blob: ebac532eb75b0aba6f5185b801e3c52bbd3ef0e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* { dg-do run { target tls_runtime } } */
/* { dg-options "-O2" } */
/* { dg-add-options tls } */

__thread unsigned char tls_array[64];

unsigned char
__attribute__ ((noinline))
tls_array_lookup_with_negative_constant(long long int position) {
  return tls_array[position - 1];
}

int
main ()
{
  int i;

  for (i = 0; i < sizeof (tls_array) / sizeof (tls_array[0]); i++)
    tls_array[i] = i;

  for (i = 0; i < sizeof (tls_array) / sizeof (tls_array[0]); i++)
    if (i != tls_array_lookup_with_negative_constant (i + 1))
      __builtin_abort ();
  return 0;
}