<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/87307>87307</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [OpenMP] Nested parallel with tasking contains data race
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jpeyton52
      </td>
    </tr>
</table>

<pre>
    When a nested parallel region ends it calls `__kmp_join_call()`. During this call, the primary thread of the nested parallel region will reset its tid (retval of `omp_get_thread_num()`) to what it was in the outer parallel region. A data race occurs with the current code when another worker thread from the nested parallel region tries to steal tasks from the primary thread's task deque. The worker thread reads the tid value directly from the primary thread's data structure and may read the wrong value.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8Uk2PnDoQ_DXm0lrkMTDMHDjse6u5vY9DpByRMT3gHWMTd3vR_PsIT5JVVspeAHVTVV3dpYns5BE70fwlmpdCJ55D7F5XvHPwjSqGMN67rzN60OCRGEdYddTOoYOIkw0e0I8ElsFo5wjEUfb9bVn712B9v9eEOgl1FkdZwkuK1k_AsyV4tP4GnhHWaBcd78BzRD1CuObqH_Q26_ZvQgbLBGxHEOoUkd-026HiKMOy9hNy_-DrfVp-DSHUGTjANusdDpsmsD7LhcQYP6qV8AyjZg1RG4RgTIoEm-U5Q0yKET2DCSPClrfkA88YYQvxhvGnoWsMy2eWOFqkfSxi1A5Y043eQb9vR6iW8h8w4reEJXyZ8YPc_qAM3Zfzpl1CGG1Ew-7-KW12ShyT4RQRtB9h0ffMlyFbDH56EJbF2FXjuTrrArtDe1BStceqKubOyKo246lVw1UPjRlMqxDNSV9PEit5bgrbKalqWUslq0PVVGU7NG1dK1R4wLoyUtQSF21d6dzbUoY4FZYoYXdqK9kWTg_oKCdWKY8b5KZQag9w7HbM05AmErV0lpjeWdiyy1H_b0X_z_-ieYF_PxzkcVpNtz2nJnjW1tN7AooUXTczrySqZ6EuQl0my3MaShMWoS671I_X0xrDKxoW6pIHJKEu2cD3AAAA__9rvDBg">