From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6023 invoked by alias); 8 Dec 2011 16:48:02 -0000 Received: (qmail 5969 invoked by uid 22791); 8 Dec 2011 16:47:59 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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; Thu, 08 Dec 2011 16:47:45 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/51262] [4.7 Regression] ICE: SIGSEGV in primary_template_instantiation_p (pt.c:2874) with -flto -g Date: Thu, 08 Dec 2011 17:06: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: ice-on-valid-code, lto X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: CC 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: 2011-12/txt/msg00916.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51262 Richard Guenther changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dodji at gcc dot gnu.org, | |jason at gcc dot gnu.org --- Comment #3 from Richard Guenther 2011-12-08 16:46:41 UTC --- Program received signal SIGSEGV, Segmentation fault. 0x0000000000569d33 in primary_template_instantiation_p (t=0x7ffff5b8f930) at /space/rguenther/src/svn/trunk/gcc/cp/pt.c:2874 2874 else if (CLASS_TYPE_P (t) && !TYPE_DECL_ALIAS_P (TYPE_NAME (t))) (gdb) but TYPE_NAME (t) is NULL: (gdb) call debug_tree (t) constant 64> unit size constant 8> align 64 symtab -173746304 alias set -1 canonical type 0x7ffff5b8f930 fields sizes-gimplified asm_written unsigned type_6 DI size unit size align 64 symtab -173747024 alias set -1 canonical type 0x7ffff5a472a0> used unsigned nonlocal decl_3 DI file t.C line 6 col 12 size unit size align 64 offset_align 128 offset bit offset context > context full-name "union" X() X(constX&) this=(X&) chain > cleared by the C++ free_lang_data langhook: if (CP_AGGREGATE_TYPE_P (t) && TYPE_NAME (t)) { tree name = TYPE_NAME (t); if (TREE_CODE (name) == TYPE_DECL) name = DECL_NAME (name); /* Drop anonymous names. */ if (name != NULL_TREE && ANON_AGGRNAME_P (name)) TYPE_NAME (t) = NULL_TREE; the type is anonymous before: chain > does not have DECL_LANG_FLAG_6 set (TYPE_DECL_ALIAS_P). Dodji, Jason, can such anonymous name types ever have TYPE_DECL_ALIAS_P set? Thus, is a valid fix Index: pt.c =================================================================== --- pt.c (revision 182117) +++ pt.c (working copy) @@ -2871,7 +2871,8 @@ primary_template_instantiation_p (const_ return DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INSTANTIATION (t) && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (t)); - else if (CLASS_TYPE_P (t) && !TYPE_DECL_ALIAS_P (TYPE_NAME (t))) + else if (CLASS_TYPE_P (t) + && TYPE_NAME (t) && !TYPE_DECL_ALIAS_P (TYPE_NAME (t))) return CLASSTYPE_TEMPLATE_INSTANTIATION (t) && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)); else if (TYPE_P (t) ? Technically clearing the anonymous names is probably no longer necessary, I'm testing a patch to remove that.