xfail scan-tree-dump-not throw in g++.dg/pr99966.C on hppa*64*-*-*
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / master-combined-1.c
blob3e6da095122ec9e66f9954469b9c1ad5552cc029
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 /* { dg-additional-options "-std=c99" { target c } } */
4 /* { dg-additional-options "-msse2" { target sse2_runtime } } */
5 /* { dg-additional-options "-mavx" { target avx_runtime } } */
7 #include <omp.h>
8 #include <stdlib.h>
10 #define N 64
12 int
13 main ()
15 int p, *q, i, l;
16 int a[N];
17 q = a;
18 #pragma omp parallel master num_threads(4) private (p) shared(a)
20 int i;
21 p = omp_get_thread_num ();
22 if (p != 0)
23 abort ();
24 #pragma omp taskloop nogroup
25 for (i = 0; i < N; ++i)
27 if (omp_get_thread_num () >= 4)
28 abort ();
29 a[i] = i;
32 #pragma omp parallel num_threads(4)
34 #pragma omp master taskloop lastprivate (i, l) firstprivate (q)
35 for (i = 0; i != N; i = i + 1)
36 l = q[i];
38 if (i != N || l != N - 1)
39 abort ();
40 #pragma omp parallel master taskloop num_threads(4) \
41 lastprivate (i, l) firstprivate (q)
42 for (i = 0; i < N - 5; i += 2)
43 if (q[i] != i)
44 abort ();
45 else
46 l = q[i];
47 if (i != N - 4 || l != N - 6)
48 abort ();
49 #pragma omp parallel master taskloop simd num_threads(4)
50 for (i = 0; i < N; i++)
51 a[i] = 2 * a[i];
52 if (i != N)
53 abort ();
54 #pragma omp parallel num_threads(4)
56 int j;
57 #pragma omp master taskloop simd collapse(2)
58 for (i = 0; i < 2; i += 2)
59 for (j = 0; j < N; j++)
60 a[j] = a[j] + 1;
62 for (i = 0; i < N; i++)
63 if (a[i] != 2 * i + 1)
64 abort ();
65 return 0;