https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61933
--- Comment #9 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> --- (In reply to Jerry DeLisle from comment #8) > You might notice that we redefined existence to be whether or not it is > connected. Units get connected when opened so your sample code needs only > ask: > > IF ((.NOT.is_open).AND.(istat == 0)) RETURN > > Whether this is what we really want to do of course is open to discussion. > > The other definition for existence is .true. for all units except -1 which > is moot because -1 will give an error and the test for existence is always > .true. and not needed. Also unit existence is processor dependent. > > In your opinion, should we change it to the other definition? Unit > existence is sort of a nebulous situation. Will your code be more portable > without the test for existence? The code in comment #7 worked on all compilers we had access to (and is part of our released code since ages), so this change of behaviour would be a problem. I think unless gfortran has a maximum for the allowed unit numbers, any postive unit number should exist (i.e. can possibly be used in an open statement). Since: > cat test.f90 open(UNIT=HUGE(1_16)) END yields: > ./a.out At line 1 of file test.f90 Fortran runtime error: Unit number in I/O statement too large that would be a unit that doesn't exist.