https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95119
--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- So, in order for this to hang, two close statements on the same unit are needed, the first one with an error message. Seems like the unit is not unlocked on the error return.