https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98738
--- Comment #6 from Kwok Yeung <kcy at codesourcery dot com> --- It seems to be the '#pragma omp taskwait' inside the parallel region that is causing the intermittent hang - if you add it to task-detach-5.c, the hang also happens there (i.e. the target construct is not the problem). I think I added the taskwait because otherwise it always hung when the region was offloaded to a Nvidia accelerator.