From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1552 invoked by alias); 6 Jun 2012 11:56:13 -0000 Received: (qmail 1542 invoked by uid 22791); 6 Jun 2012 11:56:12 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Jun 2012 11:55:58 +0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/53470] [4.8 Regression] ICE when linking with -g in splice_child_die, at dwarf2out.c:4264 Date: Wed, 06 Jun 2012 11:56:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Keywords: lto X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 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-06/txt/msg00314.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53470 --- Comment #8 from rguenther at suse dot de 2012-06-06 11:55:32 UTC --- On Tue, 5 Jun 2012, jason at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53470 > > Jason Merrill changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |jason at gcc dot gnu.org > > --- Comment #7 from Jason Merrill 2012-06-05 18:07:14 UTC --- > OK, here's the problem: > > free_lang_data_in_type clears TYPE_CONTEXT of Holder. > gen_tagged_type_die tries to emit an enclosing class first, but since > TYPE_CONTEXT is null, it thinks Holder isn't a nested class. > gen_struct_or_union_type_die calls scope_die_for, which forces out > ExtensionCord, which also generates a DIE for Holder. > gen_struct_or_union_type_die contiues to generate what is now a duplicate DIE > for Holder. > > What is the rationale for clearing TYPE_CONTEXT of Holder? It seems quite > deliberate, but there's no comment explaining why it would be a good idea. All of the clearing is done to push down memory usage and/or cause types to be referenced that are otherwise unused. A way to retain the latter would be to not recurse into TYPE_CONTEXT during find_decls_types_r and in free_lang_data_in_type only reset TYPE_CONTEXT when that is not in fld.pset (thus we didn't visit it, aka, it is unused). Not sure if this will reliably fix this kind of ICEs. Note that the fundamental issue with running free-lang-data with -g0 and lto1 with -g is that free-lang-data with -g0 assumes we won't generate debug information. I think the case in question is the only remaining case we do different things -g0 vs. -g in free-lang-data - and we should definitely remove that inconsistency. Thus, I suppose even the simple Index: tree.c =================================================================== --- tree.c (revision 188260) +++ tree.c (working copy) @@ -4575,10 +4575,9 @@ free_lang_data_in_type (tree type) free_lang_data_in_one_sizepos (&TYPE_SIZE (type)); free_lang_data_in_one_sizepos (&TYPE_SIZE_UNIT (type)); - if (debug_info_level < DINFO_LEVEL_TERSE - || (TYPE_CONTEXT (type) - && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL - && TREE_CODE (TYPE_CONTEXT (type)) != NAMESPACE_DECL)) + if (TYPE_CONTEXT (type) + && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL + && TREE_CODE (TYPE_CONTEXT (type)) != NAMESPACE_DECL) TYPE_CONTEXT (type) = NULL_TREE; } should be ok at the expense of extra memory/disk space usage at -g0 (note we walk TYPE_CONTEXT for all types in find_decls_types_r, so even the restriction above looks odd - either we should restrict recursion as well or never clear TYPE_CONTEXT). Richard.