Skip to content

Commit

Permalink
[OpenMP] Check loc for NULL before dereferencing it
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bryanpkc committed Jun 7, 2021
1 parent e1da329 commit 54f059c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion openmp/runtime/src/kmp_dispatch.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 54f059c

Please sign in to comment.