| 1 |
/* PR middle-end/32362 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-additional-options "-Wno-deprecated-declarations" } */ |
| 4 |
|
| 5 |
#include <omp.h> |
| 6 |
#include <stdlib.h> |
| 7 |
|
| 8 |
int a = 2; |
| 9 |
|
| 10 |
int |
| 11 |
main () |
| 12 |
{ |
| 13 |
int n[4] = { -1, -1, -1, -1 }; |
| 14 |
int b = 4; |
| 15 |
omp_set_num_threads (4); |
| 16 |
omp_set_dynamic (0); |
| 17 |
omp_set_nested (1); |
| 18 |
#pragma omp parallel private(b) |
| 19 |
{ |
| 20 |
b = omp_get_thread_num (); |
| 21 |
#pragma omp parallel firstprivate(a) |
| 22 |
{ |
| 23 |
a = (omp_get_thread_num () + a) + 1; |
| 24 |
if (b == omp_get_thread_num ()) |
| 25 |
n[omp_get_thread_num ()] = a + (b << 4); |
| 26 |
} |
| 27 |
} |
| 28 |
if (n[0] != 3) |
| 29 |
abort (); |
| 30 |
if (n[3] != -1 |
| 31 |
&& (n[1] != 0x14 || n[2] != 0x25 || n[3] != 0x36)) |
| 32 |
abort (); |
| 33 |
return 0; |
| 34 |
} |