https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65563 Mikael Morin changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #5 from Mikael Morin --- Maybe this works? Index: io/open.c =================================================================== --- io/open.c (révision 221654) +++ io/open.c (copie de travail) @@ -595,6 +595,8 @@ new_unit (st_parameter_open *opp, gfc_unit *u, uni u->strm_pos = stell (u->s) + 1; } + free (u->filename); + u->filename = NULL; u->filename = fc_strdup (opp->file, opp->file_len); /* Curiously, the standard requires that the @@ -666,8 +668,6 @@ already_open (st_parameter_open *opp, gfc_unit * u if (u->filename && u->flags.status == STATUS_SCRATCH) unlink (u->filename); #endif - free (u->filename); - u->filename = NULL; u = new_unit (opp, u, flags); if (u != NULL) >From gcc-bugs-return-482153-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Mar 28 20:03:20 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 115699 invoked by alias); 28 Mar 2015 20:03:20 -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 Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 115597 invoked by uid 48); 28 Mar 2015 20:03:11 -0000 From: "mikael at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/65563] Segfault on reopening fort.xxx file with explicit name Date: Sat, 28 Mar 2015 23:15: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-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mikael at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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-03/txt/msg03297.txt.bz2 Content-length: 401 https://gcc.gnu.org/bugzilla/show_bug.cgi?ide563 --- Comment #6 from Mikael Morin --- (In reply to Jerry DeLisle from comment #3) > I cannot reproduce this on trunk (5.0) and I get nothing with > -fsanitize­dress > accept the error message. This is on x86-64-linux. > Same here. I do get a segfault with the system libgfortran (4.8.3), not with trunk (unpatched).