[OpenMP] Fix a race in task queue reallocation
authorJoachim Protze <protze@itc.rwth-aachen.de>
Mon, 25 May 2020 08:19:35 +0000 (10:19 +0200)
committerJoachim Protze <protze@itc.rwth-aachen.de>
Mon, 25 May 2020 08:23:22 +0000 (10:23 +0200)
commit3895148d7cd8ff76220f8f8209ec06369a8e816f
tree46073296de279559a07eee77e596791d703811e9
parentb752a2743ab0d24d8da5d97c07fbdb996df78b1f
[OpenMP] Fix a race in task queue reallocation

__kmp_realloc_task_deque implicitly assumes, that the task queue is full
(ntasks == size), therefore tail = size in line 319.
An assertion is added to document this assumption.

The first check for a full queue is before the locking and might not hold
when the lock is taken. So, we need to check again for this condition when
we have the lock.

Reviewed By: AndreyChurbanov

Differential Revision: https://reviews.llvm.org/D80480
openmp/runtime/src/kmp_tasking.cpp