From 420cbcd0c443772681193907042deb4a79b54696 Mon Sep 17 00:00:00 2001 From: Jonathan Peyton Date: Fri, 24 Aug 2018 18:05:00 +0000 Subject: [PATCH] [OpenMP] Add check for hot_teams array If hot teams are not being used, this code could seg fault without the added check, and does so when composability is used in conjunction with nesting. The fix prevents the segfault. Differential Revision: https://reviews.llvm.org/D50649 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@340629 91177308-0d34-0410-b5e6-96231b3b80d8 --- runtime/src/kmp_runtime.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runtime/src/kmp_runtime.cpp b/runtime/src/kmp_runtime.cpp index 0ccf6a5..44e50c1 100644 --- a/runtime/src/kmp_runtime.cpp +++ b/runtime/src/kmp_runtime.cpp @@ -2115,7 +2115,8 @@ int __kmp_fork_call(ident_t *loc, int gtid, master_th->th.th_task_state; master_th->th.th_task_state_top++; #if KMP_NESTED_HOT_TEAMS - if (team == master_th->th.th_hot_teams[active_level].hot_team) { + if (master_th->th.th_hot_teams && + team == master_th->th.th_hot_teams[active_level].hot_team) { // Restore master's nested state if nested hot team master_th->th.th_task_state = master_th->th