summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tls/static-1.C
blob: 506b0fcf7a0eecde254bb7b7643e0566467c990e (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
27
28
29
30
// { dg-do run }
// { dg-options "-O2" }
// { dg-require-effective-target tls_runtime }
// { dg-add-options tls }
// { dg-additional-sources "static-1a.cc" }

extern "C" void abort ();
extern int test ();

struct A
{
  static __thread int i;
};

__thread int A::i = 8;

int
main ()
{
  if (A::i != 8)
    abort ();

  if (test ())
    abort ();

  if (A::i != 17)
    abort ();

  return 0;
}