36 lines · c
1// RUN: %libomp-compile2// RUN: env KMP_FORKJOIN_BARRIER=0,0 %libomp-run3// RUN: env KMP_PLAIN_BARRIER=0,0 %libomp-run4// RUN: env KMP_REDUCTION_BARRIER=0,0 %libomp-run5// RUN: env KMP_ALIGN_ALLOC=7 %libomp-run6// RUN: env KMP_ALIGN_ALLOC=8 %libomp-run7// RUN: env KMP_AFFINITY='explicit,proclist=[0-1222333333333444444]' %libomp-run8// RUN: env KMP_AFFINITY=disabled OMP_DISPLAY_AFFINITY=TRUE %libomp-run9//10// Test that certain environment variable values do not crash the runtime.11#include <omp.h>12#include <stdlib.h>13 14int a = 0;15 16int 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 zero23 // because we are using reduction on thread numbers.24 return 0;25 }26 return 1;27}28 29int main(int argc, char **argv) {30 int status = EXIT_SUCCESS;31 if (!test()) {32 status = EXIT_FAILURE;33 }34 return status;35}36