The __kmp_execute_tasks_template() function reads the task_team and
current_task from the thread structure. There appears to be a pathological
timing where the number of threads in the hot team decreases and so a
thread is put in the pool via __kmp_free_thread(). It could be the case where
first: a thread reads th_task_team into task_team local variables
and is then interrupted by the OS
second: the master free's the thread and sets the current task and task team to NULL
third: the thread reads current_task as NULL
When this happens, current_task is dereferenced and a segfault occurs.
This patch just checks for current_task to not be NULL as well.