| 1 |
// RUN: %libomp-compile |
| 2 |
// RUN: env KMP_FORKJOIN_BARRIER=0,0 %libomp-run |
| 3 |
// RUN: env KMP_PLAIN_BARRIER=0,0 %libomp-run |
| 4 |
// RUN: env KMP_REDUCTION_BARRIER=0,0 %libomp-run |
| 5 |
// RUN: env KMP_ALIGN_ALLOC=7 %libomp-run |
| 6 |
// RUN: env KMP_ALIGN_ALLOC=8 %libomp-run |
| 7 |
// RUN: env KMP_AFFINITY='explicit,proclist=[0-1222333333333444444]' %libomp-run |
| 8 |
// RUN: env KMP_AFFINITY=disabled OMP_DISPLAY_AFFINITY=TRUE %libomp-run |
| 9 |
// |
| 10 |
// Test that certain environment variable values do not crash the runtime. |
| 11 |
#include <omp.h> |
| 12 |
#include <stdlib.h> |
| 13 |
|
| 14 |
int a = 0; |
| 15 |
|
| 16 |
int test() { |
| 17 |
#pragma omp parallel reduction(+ : a) |
| 18 |
{ |
| 19 |
a += omp_get_thread_num(); |
| 20 |
} |
| 21 |
if (a == 0) { |
| 22 |
// If the test passes, 'a' should not be zero |
| 23 |
// because we are using reduction on thread numbers. |
| 24 |
return 0; |
| 25 |
} |
| 26 |
return 1; |
| 27 |
} |
| 28 |
|
| 29 |
int main(int argc, char **argv) { |
| 30 |
int status = EXIT_SUCCESS; |
| 31 |
if (!test()) { |
| 32 |
status = EXIT_FAILURE; |
| 33 |
} |
| 34 |
return status; |
| 35 |
} |