From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27886 invoked by alias); 28 Jul 2010 13:14:38 -0000 Received: (qmail 27784 invoked by uid 48); 28 Jul 2010 13:14:22 -0000 Date: Wed, 28 Jul 2010 13:14:00 -0000 Message-ID: <20100728131422.27783.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/45087] -fwhole-program: Miscompiled due to wrong decls In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus 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: 2010-07/txt/msg03085.txt.bz2 ------- Comment #4 from burnus at gcc dot gnu dot org 2010-07-28 13:14 ------- (In reply to comment #3) > Minimal test case, compile with: > gfortran --param ggc-min-expand=0 --param ggc-min-heapsize=0 The problems seems to be that one tries to free the NEXT twice - once for the symbol in VALUE and once as global procedure; this can be seen by the value 0xa5a5a5a5a5a5a5a5 in the dump - and by looking at the place where it crashes, namely: gt_ggc_mx_function; the cleanup is done for the module, i.e. gt_ggc_m_P17module_htab_entry4htab. [Actually, it could also be that one frees "VALUE" twice - I have not verified that it is NEXT.] I thought something like the following would help - but it does _not_: --- trans-decl.c (revision 162619) +++ trans-decl.c (working copy) @@ -3409,6 +3409,9 @@ gfc_create_module_variable (gfc_symbol * if (sym->attr.entry) return; + if (sym->attr.if_source != IFSRC_DECL) + return; + /* Make sure we convert the types of the derived types from iso_c_binding into (void *). */ if (sym->attr.flavor != FL_PROCEDURE && sym->attr.is_iso_c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45087