aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tls/emutls-3.c
blob: e062ba8f2a316d171198b0c5b0e8e721dfa35edb (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
26
/* { dg-do run } */
/* { dg-require-effective-target tls } */
/* { dg-require-effective-target global_constructor } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target tls_runtime } */
/* { dg-add-options tls } */

__thread int i __attribute__((common));

extern void abort (void);

int test_code(int b)
{
  i += b ;
  return i;
}

int main (int ac, char *av[])
{
  int a = test_code(test_code(1));
  
  if ((a != 2) || (i != 2))
    abort () ;
  
  return 0;
}