| 1 |
#include <omp.h> |
| 2 |
#include <stdlib.h> |
| 3 |
|
| 4 |
struct S { S () : s (42) {} S (const S &x) : s (x.s) {}; ~S () {} int s; }; |
| 5 |
|
| 6 |
int |
| 7 |
main () |
| 8 |
{ |
| 9 |
S s; |
| 10 |
s.s = 113; |
| 11 |
#pragma omp parallel num_threads(4) default(firstprivate) |
| 12 |
{ |
| 13 |
if (s.s != 113) |
| 14 |
abort (); |
| 15 |
s.s = omp_get_thread_num (); |
| 16 |
#pragma omp barrier |
| 17 |
if (s.s != omp_get_thread_num ()) |
| 18 |
abort (); |
| 19 |
} |
| 20 |
#pragma omp parallel num_threads(4) default(private) |
| 21 |
{ |
| 22 |
if (s.s != 42) |
| 23 |
abort (); |
| 24 |
s.s = omp_get_thread_num () + 13; |
| 25 |
#pragma omp barrier |
| 26 |
if (s.s != omp_get_thread_num () + 13) |
| 27 |
abort (); |
| 28 |
} |
| 29 |
} |