https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91316
--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> --- (In reply to Paul Thomas from comment #1) > I notice that this is missing from the list of dependencies of PR37336, for > which a wider fix will be submitted this afternoon. > > Best regards > > Paul I have returned to this problem. final_s4 generates illegal recursive I/O and hangs due to a mutex lock. It works fine if the I/O is removed from the final procedure. __attribute__((fn spec (". "))) void final_s4 () { struct array00_final_t D.4386; { struct __st_parameter_dt dt_parm.6; dt_parm.6.common.filename = &"/home/pault/prs/pr37336/pr91316.f90"[1]{lb: 1 sz: 1}; dt_parm.6.common.line = 127; dt_parm.6.common.flags = 128; dt_parm.6.common.unit = 6; _gfortran_st_write (&dt_parm.6); _gfortran_transfer_character_write (&dt_parm.6, &"f4: "[1]{lb: 1 sz: 1}, 4); { static integer(kind=4) C.4378 = 4; struct final_t D.4379; struct final_t D.4380; struct array00_final_t desc.7; struct final_t D.4387; integer(kind=4) D.4388; D.4379 = final_set (&C.4378); D.4380 = D.4379; desc.7.dtype = {.elem_len=4, .rank=0, .type=5}; desc.7.data = (void * restrict) &D.4379; desc.7.span = (integer(kind=8)) desc.7.dtype.elem_len; D.4386 = desc.7; D.4387 = D.4380; D.4388 = final_get (&D.4387); _gfortran_transfer_integer_write (&dt_parm.6, &D.4388, 4); if (__vtab_final_m_Final_t._final != 0B && (struct final_t * restrict) D.4386.data != 0B) { __vtab_final_m_Final_t._final (&D.4386, __vtab_final_m_Final_t._size, 0); } } _gfortran_st_write_done (&dt_parm.6); } return; } Cheers Paul