aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/pr39591-1.c
blob: a22bc337819949df1cc451a522b0f9f2c695d95c (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
/* PR other/39591 */
/* { dg-do run } */

extern void abort (void);

int e;

int
main (void)
{
#pragma omp parallel
  {
    int array[40];
    int i;
    for (i = 0; i < sizeof array / sizeof array[0]; i++)
      array[i] = 0x55555555;

#pragma omp for schedule(dynamic)
    for (i = 0; i < 50; i++)
#pragma omp task shared(array)
      {
	int j;
	for (j = 0; j < sizeof array / sizeof array[0]; j++)
	  if (array[j] != 0x55555555)
#pragma omp atomic
	    e++;
      }
  }
  if (e)
    abort ();
  return 0;
}