aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/target-same-name-1-a.c
blob: 509c238cf8d7af0c3d45a465fbe037a8804298d8 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* { dg-skip-if "" { *-*-* } } */
/* Used by target-same-name-1.c */

static int local_link = 42;
#pragma omp declare target link(local_link)

int decl_a_link = 123;
#pragma omp declare target link(decl_a_link)

#pragma omp declare target
static int __attribute__ ((noinline,noclone))
foo ()
{
  return 5;
}
#pragma omp end declare target

static int __attribute__ ((noinline,noclone))
bar ()
{
  int i;
  #pragma omp target map(from:i)
    i = foo ();
  return i;
}

int
one () {
  return bar ();
}

int
one_get_inc2_local_link ()
{
  int res, res2;
#pragma omp target map(from: res, res2)
  {
    res = local_link;
    local_link += 2;
    res2 = local_link;
  }
  if (res + 2 != res2)
    __builtin_abort ();
  return res;
}

int
one_get_inc3_link_a ()
{
  int res, res2;
#pragma omp target map(from: res, res2)
  {
    res = decl_a_link;
    decl_a_link += 3;
    res2 = decl_a_link;
  }
  if (res + 3 != res2)
    __builtin_abort ();
  return res;
}