From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17356 invoked by alias); 16 Jan 2015 15:22:57 -0000 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 Received: (qmail 17317 invoked by uid 48); 16 Jan 2015 15:22:52 -0000 From: "Joost.VandeVondele at mat dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/61933] Inquire on internal units Date: Fri, 16 Jan 2015 15:22:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: Joost.VandeVondele at mat dot ethz.ch X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jvdelisle at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-01/txt/msg01531.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61933 --- Comment #9 from Joost VandeVondele --- (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.