The following program runs without error when compiled with g77 3.4.6 on Redhat
Linux:

       character*72 fnint
       data fnint /'/dev/null'/
       i=index(fnint,' ')
       open(unit=29,file=fnint(1:i-1))
       open(unit=30,file=fnint(1:i-1))
       write(29,100)
       write(30,100)
 100   format('1Hello, world!')
       end

When compiled with gfortran 4.3.2 on Redhat Linux, the following error message
is printed when the program is run:

At line 5 of file bug.f (unit = 30, file = '')
Fortran runtime error: File already opened in another unit

The same error results when I use /dev/tty in place of /dev/null, although this
too works in g77 3.4.6.

This bug is causing me to have to modify a program called NONMEM VI to get it
to run properly.


-- 
           Summary: "file already opened in another unit" error when opening
                    /dev/null or /dev/tty twice
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steven dot chapel at sbcglobal dot net
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38122

Reply via email to