aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gomp/pr89796.C
blob: 6bbc34eae324d16d04e9aca07b319de1b46f9919 (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
// PR c++/89796
// { dg-do compile }
// { dg-additional-options "-Wunused-value" }

int
f1 (int &c)
{
  int r;
  #pragma omp atomic capture	// { dg-bogus "value computed is not used" }
  { r = c; c++; }
  return r;
}

template <int N>
int
f2 (int &c)
{
  int r;
  #pragma omp atomic capture	// { dg-bogus "value computed is not used" }
  { r = c; c++; }
  return r;
}

int
f3 (int &c)
{
  return f2 <0> (c);
}

int
f4 (int *p)
{
  int r;
  #pragma omp atomic capture	// { dg-bogus "value computed is not used" }
  { r = *p; (*p)++; }
  return r;
}

template <int N>
int
f5 (int *p)
{
  int r;
  #pragma omp atomic capture	// { dg-bogus "value computed is not used" }
  { r = *p; (*p)++; }
  return r;
}

int
f6 (int *p)
{
  return f5 <0> (p);
}