summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/omp-loop02.c
blob: 04aaea2e356cfc914c81004e2113c2fbc44d4bd4 (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
#include <omp.h>

/* Orphaned work sharing.  */

extern void abort (void);

#define N 10

void parloop (int *a)
{
  int i;

#pragma omp for
  for (i = 0; i < N; i++)
    a[i] = i + 3;
}

main()
{
  int i, a[N];

#pragma omp parallel shared(a)
  {
    parloop (a);
  }

  for (i = 0; i < N; i++)
    if (a[i] != i + 3)
      abort ();

  return 0;
}