aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60586.c
blob: e2dc7b0c9d57da24cf7e543065d3579981763aa6 (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
/* { dg-do run } */
/* { dg-require-effective-target cilkplus_runtime } */
/* { dg-options "-fcilkplus -O2" } */

int noop(int x)
{
  return x;
}

int post_increment(int *x)
{
  return (*x)++;
}

int main(int argc, char *argv[])
{
  int m = 5;
  int n = m;
  int r = _Cilk_spawn noop(post_increment(&n));
  int n2 = n;
  _Cilk_sync;

  if (r != m || n2 != m + 1)
    return 1;
  else
    return 0;
}