Skip to content

Commit c3acb45

Browse files
committed
[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.
1 parent 7e2379a commit c3acb45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

openmp/runtime/src/kmp_dispatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static inline int __kmp_get_monotonicity(ident_t *loc, enum sched_type schedule,
7777

7878
// Let default be monotonic for executables
7979
// compiled with OpenMP* 4.5 or less compilers
80-
if (loc->get_openmp_version() < 50)
80+
if (loc != NULL && loc->get_openmp_version() < 50)
8181
monotonicity = SCHEDULE_MONOTONIC;
8282

8383
if (use_hier)

0 commit comments

Comments
 (0)