From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30848 invoked by alias); 25 Dec 2012 04:52:27 -0000 Received: (qmail 30810 invoked by uid 48); 25 Dec 2012 04:52:05 -0000 From: "jvdelisle at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/48960] OPEN statement modifies NEWUNIT variable on error Date: Tue, 25 Dec 2012 04:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jvdelisle at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jvdelisle at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-12/txt/msg02300.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48960 --- Comment #3 from Jerry DeLisle 2012-12-25 04:52:04 UTC --- A slight modification and still testing. @@ -859,6 +856,10 @@ st_open (st_parameter_open *opp) else already_open (opp, u, &flags); } - + + if ((opp->common.flags & IOPARM_OPEN_HAS_NEWUNIT) + && (opp->common.flags & IOPARM_LIBRETURN_MASK) == IOPARM_LIBRETURN_OK) + *opp->newunit = opp->common.unit; + library_end (); }