https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90230
Janne Blomqvist <jb at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |jb at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Janne Blomqvist <jb at gcc dot gnu.org> --- It's not a thread-safety issue. If you uncomment the line close(lun) you get the same error message also without OpenMP. The reason is that GFortran follows the Fortran standard which says that you may not open the same file on multiple units. That being said, Fortran 2018 removes that restriction, so future versions of GFortran may behave differently.