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

    <tr>
        <th>Summary</th>
        <td>
            OpenMP program hangs after last parallel
        </td>
    </tr>

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

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

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

<pre>
    This code does not end when executing with `export KMP_HOT_TEAMS_MAX_LEVEL=0`
```cpp
// t1.c

#include <stdio.h>
#include <unistd.h>
#include <omp.h>

int main() {
    #pragma omp parallel num_threads(2)
    #pragma omp master
    {
    }
    fprintf(stderr, "Inter parallels\n");
    int a;
    #pragma omp parallel num_threads(3)
    #pragma omp master
    {
        #pragma omp task
        printf("hello\n");
    }
    #pragma omp barrier
}
```
Execute command: `clang -fopenmp t1.c -o t1 && ./t1`

I suspect this is related with https://github.com/llvm/llvm-project/issues/56307
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylU1tv2yAU_jX4BdXC4Ev84Ic0SbVqjVpp1bS3CBtss2KwAK_dv9-x06aNtkjTZh2Bz_2D81Fb8bN67JXHjRUSCys9NjZgaQR-7qXB8kU2U1Cmw88q9BjlRL6M1gX8ef9w-HT_eHjcrfdfDvv1t8Pd7uvuDrEtgSBEtois559FmnF8tdAbEBySuHk1vJqZMo2eAAJiGx-EsnGP2O5P3skoCLjotsP40besygQ8cGUQXSFaYlRcH-0YPsgeHe8GjiETj9xxraXGZhoOoXeSCw9ZFNIupQzcB-k-eM-qF9t3pR0dIGmhHhxAOofoBmrRWwP5p84eZRsAunRkHyrNZ-Bnlr9Czv4V-e_hgfunc__pPIC3l1rbC9jPbuG8aM2dU28gTnEn4hzV3UJCCRwdBm4EYuuZiI3mQMur1o7SzPCAU_jKwg4tchAcA9VC8s7GZb3FfvKjbAIOM-1BnNQ8SHEkeB_C6KHBkagdmKY6hr6gaP3jbbsanf0ONUBV3k8SbvomyxkpIlkleV7ScpVlaSQqJkpW8iiooGV1D0D3D3BrtnN8wD3A95i38_Q1jOI0wmhyuvoPIGVSkqivymbFSd2wUmb1KiVCZnlRkETkSUvzMuOR5jXwrULZNczMyGe8lJjnl20jVVFCaZLQNEkJZWmcrETbkCwtkowVBW1RSiQ8Kh3POGLrushVC6R66jw4NTxT_-7k3qvOSLm0g_p8Cr111aCeuH2Ils7VgvwX1tBX7Q">