From patchwork Mon Dec 19 14:10:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 132235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 18788B7048 for ; Tue, 20 Dec 2011 01:10:21 +1100 (EST) Received: (qmail 20945 invoked by alias); 19 Dec 2011 14:10:17 -0000 Received: (qmail 20931 invoked by uid 22791); 19 Dec 2011 14:10:15 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Dec 2011 14:10:02 +0000 Received: from relay2.suse.de (nat.nue.novell.com [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id A7B158D167; Mon, 19 Dec 2011 15:10:00 +0100 (CET) Date: Mon, 19 Dec 2011 15:10:00 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com Subject: [PATCH] Fix PR46796 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This fixes one old and annyoing bug wrt LTO and debug-information. We pre-seed the LTO tree streamer cache with nodes from global_trees[] and friends, but this causes the type variant chain to become corrupt (in the sense that we do not merge TYPE_DECLs, so a get_qualified_type will fail to find a variant because the names (TYPE_DECLs) are not pointer-equal). dwarf2out.c already contains backup code for this case (get_qualified_type returning NULL) using __unknown__ for AT_name. But we can do better, use the actual name of the type. [long term we want to stop pre-seeding the LTO tree streamer cache, but that's clearly nothing for stage3] Boostrap and regtest pending on x86_64-unknown-linux-gnu, ok if that succeeds? Thanks, Richard. 2011-12-19 Richard Guenther PR lto/46796 * dwarf2out.c (modified_type_die): When the type variant chain is corrupt use the types name, if available, instead of __unknown__. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 182472) +++ gcc/dwarf2out.c (working copy) @@ -9873,7 +9873,14 @@ modified_type_die (tree type, int is_con } /* This probably indicates a bug. */ else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type) - add_name_attribute (mod_type_die, "__unknown__"); + { + name = TYPE_NAME (type); + if (name + && TREE_CODE (name) == TYPE_DECL) + name = DECL_NAME (name); + add_name_attribute (mod_type_die, + name ? IDENTIFIER_POINTER (name) : "__unknown__"); + } if (qualified_type) equate_type_number_to_die (qualified_type, mod_type_die);