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