
A lot of these only trip when using sanitizers with the library. * Insert forgotten free()s * Change (-1) << amount to 0xffffffffu as left shifting a negative is UB * Fixup integer parser to return INT_MAX when parsing huge string of digits. e.g., 452523423423423423 returns INT_MAX * Fixup range parsing for affinity mask so integer overflow does not occur * Don't assert when branch bits are 0, instead warn user that is invalid and use the default value. * Fixup kmp_set_defaults() so the C version only uses null terminated strings and the Fortran version uses the string + size version. * Make sure the KMP_ALIGN_ALLOC is power of two, otherwise use CACHE_LINE. * Disallow ability to set KMP_TASKING=1 (task barrier) this doesn't work and hasn't worked for a long time. * Limit KMP_HOT_TEAMS_MAX_LEVEL to 1024, an array is allocated based on this value. * Remove integer values for OMP_PROC_BIND. The specification only allows strings and CSV of strings. * Fix setting KMP_AFFINITY=disabled + OMP_DISPLAY_AFFINITY=TRUE
36 lines
910 B
C
36 lines
910 B
C
// RUN: %libomp-compile
|
|
// RUN: env KMP_FORKJOIN_BARRIER=0,0 %libomp-run
|
|
// RUN: env KMP_PLAIN_BARRIER=0,0 %libomp-run
|
|
// RUN: env KMP_REDUCTION_BARRIER=0,0 %libomp-run
|
|
// RUN: env KMP_ALIGN_ALLOC=7 %libomp-run
|
|
// RUN: env KMP_ALIGN_ALLOC=8 %libomp-run
|
|
// RUN: env KMP_AFFINITY='explicit,proclist=[0-1222333333333444444]' %libomp-run
|
|
// RUN: env KMP_AFFINITY=disabled OMP_DISPLAY_AFFINITY=TRUE %libomp-run
|
|
//
|
|
// Test that certain environment variable values do not crash the runtime.
|
|
#include <omp.h>
|
|
#include <stdlib.h>
|
|
|
|
int a = 0;
|
|
|
|
int test() {
|
|
#pragma omp parallel reduction(+ : a)
|
|
{
|
|
a += omp_get_thread_num();
|
|
}
|
|
if (a == 0) {
|
|
// If the test passes, 'a' should not be zero
|
|
// because we are using reduction on thread numbers.
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
int status = EXIT_SUCCESS;
|
|
if (!test()) {
|
|
status = EXIT_FAILURE;
|
|
}
|
|
return status;
|
|
}
|