From: Bryan Chan Date: Mon, 7 Jun 2021 14:37:24 +0000 (-0400) Subject: [OpenMP] Check loc for NULL before dereferencing it X-Git-Tag: llvmorg-14-init~4681 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54f059c9007b48e4ff700ac587cbb137fff91fb7;p=platform%2Fupstream%2Fllvm.git [OpenMP] Check loc for NULL before dereferencing it The ident_t * argument in __kmp_get_monotonicity was being used without a customary NULL check, causing the function to crash in a Debug build. Release builds were not affected thanks to dead store elimination. --- diff --git a/openmp/runtime/src/kmp_dispatch.cpp b/openmp/runtime/src/kmp_dispatch.cpp index d8e935d..c2e60fc 100644 --- a/openmp/runtime/src/kmp_dispatch.cpp +++ b/openmp/runtime/src/kmp_dispatch.cpp @@ -77,7 +77,7 @@ static inline int __kmp_get_monotonicity(ident_t *loc, enum sched_type schedule, // Let default be monotonic for executables // compiled with OpenMP* 4.5 or less compilers - if (loc->get_openmp_version() < 50) + if (loc != NULL && loc->get_openmp_version() < 50) monotonicity = SCHEDULE_MONOTONIC; if (use_hier || __kmp_force_monotonic)