summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp/pr30421.c
blob: 901ba3c13a36552d20812ea53d37fdca7f5f3036 (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
/* PR middle-end/30421 */
/* { dg-do compile } */
/* { dg-options "-O2 -fopenmp -Wall" } */

int
foo ()
{
  int a = 0, i;

#pragma omp parallel for firstprivate(a) lastprivate(a)
  for (i = 0; i < 10; i++)
    a += i;

  return a;
}

int
bar ()
{
  int a = 0, i;

#pragma omp parallel for firstprivate(a) lastprivate(a) schedule(static, 2)
  for (i = 0; i < 10; i++)
    a += i;

  return a;
}

int
baz ()
{
  int a = 0, i;

#pragma omp parallel for firstprivate(a) lastprivate(a) schedule(dynamic)
  for (i = 0; i < 10; i++)
    a += i;

  return a;
}