xref: /openbsd-src/gnu/gcc/libgomp/testsuite/libgomp.c/copyin-1.c (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 /* { dg-require-effective-target tls_runtime } */
4 
5 #include <omp.h>
6 #include <stdlib.h>
7 
8 int thr = 32;
9 #pragma omp threadprivate (thr)
10 
11 int
main(void)12 main (void)
13 {
14   int l = 0;
15 
16   omp_set_dynamic (0);
17   omp_set_num_threads (6);
18 
19 #pragma omp parallel copyin (thr) reduction (||:l)
20   {
21     l = thr != 32;
22     thr = omp_get_thread_num () + 11;
23   }
24 
25   if (l || thr != 11)
26     abort ();
27 
28 #pragma omp parallel reduction (||:l)
29   l = thr != omp_get_thread_num () + 11;
30 
31   if (l)
32     abort ();
33   return 0;
34 }
35