comparison libgomp/testsuite/libgomp.c/copyin-3.c @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children 04ced10e8804
comparison
equal deleted inserted replaced
-1:000000000000 0:a06113de4d67
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;
9 #pragma omp threadprivate (thr)
10
11 int
12 test (int l)
13 {
14 return l || (thr != omp_get_thread_num () * 2);
15 }
16
17 int
18 main (void)
19 {
20 int l = 0;
21
22 omp_set_dynamic (0);
23 omp_set_num_threads (6);
24
25 thr = 8;
26 /* Broadcast the value to all threads. */
27 #pragma omp parallel copyin (thr)
28 ;
29
30 #pragma omp parallel reduction (||:l)
31 {
32 /* Now test if the broadcast succeeded. */
33 l = thr != 8;
34 thr = omp_get_thread_num () * 2;
35 #pragma omp barrier
36 l = test (l);
37 }
38
39 if (l)
40 abort ();
41 return 0;
42 }