Mercurial > hg > CbC > CbC_gcc
comparison libgomp/testsuite/libgomp.c/omp-single-2.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 #include <omp.h> | |
2 | |
3 extern void abort (void); | |
4 | |
5 struct X | |
6 { | |
7 int a; | |
8 char b; | |
9 int c; | |
10 }; | |
11 | |
12 main() | |
13 { | |
14 int i = 0; | |
15 struct X x; | |
16 int bad = 0; | |
17 | |
18 #pragma omp parallel private (i, x) shared (bad) | |
19 { | |
20 i = 5; | |
21 | |
22 #pragma omp single copyprivate (i, x) | |
23 { | |
24 i++; | |
25 x.a = 23; | |
26 x.b = 42; | |
27 x.c = 26; | |
28 } | |
29 | |
30 if (i != 6 || x.a != 23 || x.b != 42 || x.c != 26) | |
31 bad = 1; | |
32 } | |
33 | |
34 if (bad) | |
35 abort (); | |
36 | |
37 return 0; | |
38 } |