https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99555

--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
This fixes the hang:
...
@@ -91,14 +129,16 @@ gomp_team_barrier_wait_end (gomp_barrier_t *bar,
gomp_barrier_state_t state)
        {
          gomp_barrier_handle_tasks (state);
          state &= ~BAR_WAS_LAST;
+         gen = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE);
+         if (gen == state + BAR_INCR)
+           return;
        }
       else
        {
...

I'm not yet sure about the implementation, but the idea is to detect that
gomp_team_barrier_done was called during gomp_barrier_handle_tasks, and then
bail out.

Reply via email to