Daily bump.
[official-gcc.git] / libgomp / testsuite / libgomp.c / copyin-3.c
blob0a176c4a54e4a7e380ffaeab3883ecbb420fd882
1 /* { dg-do run } */
2 /* { dg-require-effective-target tls_runtime } */
4 #include <omp.h>
5 #include <stdlib.h>
7 int thr;
8 #pragma omp threadprivate (thr)
10 int
11 test (int l)
13 return l || (thr != omp_get_thread_num () * 2);
16 int
17 main (void)
19 int l = 0;
21 omp_set_dynamic (0);
22 omp_set_num_threads (6);
24 thr = 8;
25 /* Broadcast the value to all threads. */
26 #pragma omp parallel copyin (thr)
29 #pragma omp parallel reduction (||:l)
31 /* Now test if the broadcast succeeded. */
32 l = thr != 8;
33 thr = omp_get_thread_num () * 2;
34 #pragma omp barrier
35 l = test (l);
38 if (l)
39 abort ();
40 return 0;