https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99555
--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #8) > This fixes the hang: This is a less intrusive solution, and is easier to transplant into gomp_team_barrier_wait_cancel_end: ... diff --git a/libgomp/config/nvptx/bar.c b/libgomp/config/nvptx/bar.c index c5c2fa8829b..cb7b299c6a8 100644 --- a/libgomp/config/nvptx/bar.c +++ b/libgomp/config/nvptx/bar.c @@ -91,6 +91,9 @@ gomp_team_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t state) { gomp_barrier_handle_tasks (state); state &= ~BAR_WAS_LAST; + if (team->task_count != 0) + __builtin_abort (); + bar->total = 1; } else { @@ -157,6 +160,9 @@ gomp_team_barrier_wait_cancel_end (gomp_barrier_t *bar, { gomp_barrier_handle_tasks (state); state &= ~BAR_WAS_LAST; + if (team->task_count != 0) + __builtin_abort (); + bar->total = 1; } else { ...