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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #22 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
One possible approach would be to record in the gfc_unit structure which
thread locked the unit.

The test for recursive I/O could then be (pseudo-code)

  if (TRYLOCK(&p->lock)) {
     lock_thread_id = read_atomic (p->thread_id);
     if (lock_thread_id == my_thread_id)) {
         generate_error(...)
     }
     UNLOCK(&p->lock);
  }

This would be a hand-rolled version of what Jakub proposed in
https://gcc.gnu.org/pipermail/fortran/2026-January/063291.html
(which would probably be more elegant, but I'm not sure if
that could break on other targets).

Reply via email to