On Sun, Sep 7, 2014 at 12:51 AM, Jerry DeLisle <jvdeli...@charter.net> wrote: > Hi, > > The attached patch adds a compile time check for negative unit numbers given > in > an INQUIRE statement. A new test case is provided and one updated.
What about units opened with newunit= ? Those have negative unit numbers. It seems strange that one wouldn't be allowed to inquire such units? Or if that indeed is the case, I suggest it's a bug in the standard (one can imagine such happening by forgetting to update inquire constraints after adding newunit= in f2003). program negunit implicit none logical :: file_exists integer :: u open(newunit=u, file="test.dat") inquire(unit=u, exist=file_exists) write(*,*) u, file_exists close(u, status="delete") end program negunit Testing with gfortran 4.9.1 (homebrew) on a Mac, the above program prints -10 F which is wrong, but a slightly different issue. The almost identical program program posunit implicit none logical :: file_exists integer :: u=10 open(u, file="test.dat") inquire(unit=u, exist=file_exists) write(*,*) u, file_exists close(u, status="delete") end program posunit correctly prints 10 T -- Janne Blomqvist