From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5011 invoked by alias); 26 Apr 2009 19:22:11 -0000 Received: (qmail 4960 invoked by uid 48); 26 Apr 2009 19:22:00 -0000 Date: Sun, 26 Apr 2009 19:22:00 -0000 Message-ID: <20090426192200.4959.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/39879] [4.3/4.4/4.5 Regression] double free or corruption abort with gfortran In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pault at gcc dot gnu dot org" 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: 2009-04/txt/msg02476.txt.bz2 ------- Comment #9 from pault at gcc dot gnu dot org 2009-04-26 19:22 ------- (In reply to comment #8) > I have an "obvious" (ie. after three hours staring at it:-( ) fix that is Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (revision 146772) +++ gcc/fortran/resolve.c (working copy) @@ -6645,7 +6645,8 @@ if (rhs->expr_type == EXPR_VARIABLE && rhs->symtree->n.sym->ts.type == BT_DERIVED && has_default_initializer (rhs->symtree->n.sym->ts.derived) - && (lhs->symtree->n.sym == rhs->symtree->n.sym)) + && (lhs->symtree->n.sym == rhs->symtree->n.sym) + && !(rhs->ref || lhs->ref)) code->ext.actual->next->expr = gfc_get_parentheses (rhs); return true; which regtests OK but I need a day or so to dwell on. Although the above is my doing, I do not recall for the life of me why a temporary had to be added in this case. I will attempt to recall that and figure out exactly which cases are counter-indicated. By the way, David, thanks for the report! Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39879