summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/loop-8.c
blob: 25db25c3b431acba01fb40c73b23aa0a317f1732 (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
extern void abort (void);

int buf[256];

void __attribute__((noinline))
foo (void)
{
  int i;
  #pragma omp for schedule (auto)
    for (i = 0; i < 256; i++)
      buf[i] += i;
}

int
main (void)
{
  int i;
  #pragma omp parallel for schedule (auto)
    for (i = 0; i < 256; i++)
      buf[i] = i;
  #pragma omp parallel num_threads (4)
    foo ();
  for (i = 0; i < 256; i++)
    if (buf[i] != 2 * i)
      abort ();
  return 0;
}