From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28592 invoked by alias); 14 Nov 2008 18:15:54 -0000 Received: (qmail 17924 invoked by uid 48); 14 Nov 2008 18:14:30 -0000 Date: Fri, 14 Nov 2008 18:15:00 -0000 Subject: [Bug fortran/38122] New: "file already opened in another unit" error when opening /dev/null or /dev/tty twice X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "steven dot chapel at sbcglobal dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-11/txt/msg01099.txt.bz2 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