https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81591
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I believe the check that triggers here is just wrong, if we have 2 different queuest, it is very well possible that they will have different tasks with the same priority as the next candidates. And the code right below this test doesn't make sense if t1 == t2. Thus, I think we should apply: --- libgomp/priority_queue.c.jj 2017-01-01 12:45:52.000000000 +0100 +++ libgomp/priority_queue.c 2017-08-01 16:39:20.137155439 +0200 @@ -272,10 +272,6 @@ priority_tree_next_task (enum priority_q } /* If we get here, the priorities are the same, so we must look at parent_depends_on to make our decision. */ -#if _LIBGOMP_CHECKING_ - if (t1 != t2) - gomp_fatal ("priority_tree_next_task: t1 != t2"); -#endif if (t2->parent_depends_on && !t1->parent_depends_on) { *q1_chosen_p = false; I'm not getting any failures after this change, but it doesn't explain any issues with non-_LIBGOMP_CHECKING_ builds. So, can you apply the above change and see if you can come up with a testcase that fails (segfault or some other gomp_fatal)?