[Openmp-commits] [openmp] 54f059c - [OpenMP] Check loc for NULL before dereferencing it
Bryan Chan via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jun 7 07:46:03 PDT 2021
Author: Bryan Chan
Date: 2021-06-07T10:45:48-04:00
New Revision: 54f059c9007b48e4ff700ac587cbb137fff91fb7
URL: https://github.com/llvm/llvm-project/commit/54f059c9007b48e4ff700ac587cbb137fff91fb7
DIFF: https://github.com/llvm/llvm-project/commit/54f059c9007b48e4ff700ac587cbb137fff91fb7.diff
LOG: [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.
Added:
Modified:
openmp/runtime/src/kmp_dispatch.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/kmp_dispatch.cpp b/openmp/runtime/src/kmp_dispatch.cpp
index d8e935d750807..c2e60fce9ed59 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)
More information about the Openmp-commits
mailing list