aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tls/pr47715-4.c
blob: 980d7e985df7bb7296ddafbd86b96e8d06598db1 (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
/* { dg-do compile } */
/* { dg-options "-O0" } */
/* { dg-require-effective-target tls } */

struct gomp_team_state
{
  struct gomp_team_state *prev_ts;
  unsigned team_id;
  unsigned level;
};
struct gomp_thread
{
  void *data;
  struct gomp_team_state ts;
};
extern __thread struct gomp_thread gomp_tls_data;
int
foo (int level)
{
  struct gomp_team_state *ts = &gomp_tls_data.ts;
  if (level < 0 || level > ts->level)
    return -1;
  return ts->team_id;
}