sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.c / task-4.c
blob18435930019154056af3a4111243fcceb3528308
1 /* { dg-do run } */
3 #include <omp.h>
4 #include <stdlib.h>
5 #include <string.h>
7 int e;
9 void __attribute__((noinline))
10 baz (int i, int *p, int j, int *q)
12 if (p[0] != 1 || p[i] != 3 || q[0] != 2 || q[j] != 4)
13 #pragma omp atomic
14 e++;
17 void __attribute__((noinline))
18 foo (int i, int j)
20 int p[i + 1];
21 int q[j + 1];
22 memset (p, 0, sizeof (p));
23 memset (q, 0, sizeof (q));
24 p[0] = 1;
25 p[i] = 3;
26 q[0] = 2;
27 q[j] = 4;
28 #pragma omp task firstprivate (p, q)
29 baz (i, p, j, q);
32 int
33 main (void)
35 #pragma omp parallel num_threads (4)
36 foo (5 + omp_get_thread_num (), 7 + omp_get_thread_num ());
37 if (e)
38 abort ();
39 return 0;