https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98046
--- Comment #2 from kargl at gcc dot gnu.org --- > This problem was originally reported on > https://www.linuxquestions.org/questions/linux-general-1/lock-in-libpthread- > occurs-only-on-one-arch-installation-only-with-gcc-fortran-4175685889/ > before discovering that it was triggered by the combination of gcc+atlas > lapack. Because of condition (5) this is reported as a gcc-fortran bug. It appears that the code is invalid Fortran, so gfortran can do anything. 12.12 Restrictions on input/output statements ... An input/output statement that is executed while another input/output statement is being executed is a recursive input/output statement. A recursive input/output statement shall not identify an external unit that is identified by another input/output statement being executed except that a child data transfer statement may identify its parent data transfer statement external unit. You don't have a child data transfer statement, so the exception does not apply. It may be beneficial to fix the invalid Fortran.