From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8201 invoked by alias); 21 Sep 2012 09:49:26 -0000 Received: (qmail 8113 invoked by uid 48); 21 Sep 2012 09:48:42 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54652] New: ICE with -g Date: Fri, 21 Sep 2012 09:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: 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-09/txt/msg01666.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54652 Bug #: 54652 Summary: ICE with -g Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: jakub@gcc.gnu.org CC: jason@gcc.gnu.org typedef unsigned long L __attribute__ ((aligned)); typedef unsigned long L __attribute__ ((aligned)); template struct S { union U { L l; } u; }; S s; ICEs with -g, TYPE_NAME seems to be garbage. The problem is that handle_aligned_attribute first (with L as decl): tree tt = TREE_TYPE (decl); *type = build_variant_type_copy (*type); DECL_ORIGINAL_TYPE (decl) = tt; TYPE_NAME (*type) = decl; TREE_USED (*type) = TREE_USED (decl); TREE_TYPE (decl) = *type; then duplicate_decls is called on the L olddecl (with new L as newdecl), where TYPE_NAME (TREE_TYPE (olddecl)) == olddecl and TYPE_NAME (TREE_TYPE (newdecl)) == newdecl, in merge_types newdecl's type wins, and eventually ggc_free (newdecl); So, either something should have changed TYPE_NAME (newtype) from newdecl to olddecl before ggc_free (I guess that would be preferred, but can't it be TYPE_NAME of other related types too?), or we shouldn't ggc_free TYPE_DECLs. Jason, can you please look into this?