From patchwork Wed Jul 11 13:11:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 942484 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-481355-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="BR8DHOCL"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41QfbC0Xsnz9rxs for ; Wed, 11 Jul 2018 23:11:18 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=J3xxs8n/qt8I2tABhJ/kG0R4kZRhU2hHQ6UtfIo0npDvxpbBx3 VxzaDX/48X8P01VAO5Uw062ZvMkDf7RR2U+L6k/RCPckrWWEy+VJvnuPKd4FehLW +VEbvnZ9f7YUgWym+gWvzzLDlbDpxQyv05rxGgqSLeSEOtGcbonhTiizY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=0hHMN+oHWK45laE/MLF9+LWxriU=; b=BR8DHOCLeVFuqKfvCxIq ChsdLjYGnshiCAyjAZsanX9AL6rJJx0hQ51wxwluEJ7bD7ifhrP/yMOKKIPVggHG m+4g6HU4ZEINgQjiWKoJQ9Y0uw9ORpoMjHq0HBbLPa4VyxJmareqoccQOejccX2y 6bFnJtmMvjMbcWoMl6seojQ= Received: (qmail 35383 invoked by alias); 11 Jul 2018 13:11:11 -0000 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 Received: (qmail 35369 invoked by uid 89); 11 Jul 2018 13:11:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.2 spammy=readily X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Jul 2018 13:11:09 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 37429ADE4; Wed, 11 Jul 2018 13:11:07 +0000 (UTC) Date: Wed, 11 Jul 2018 15:11:06 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: jason@redhat.com, dodji@gcc.gnu.org Subject: [PATCH] Fix PR86452 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes PR86452 by using scope_die_for which correctly deals with -g1 in not creating (new) DIEs for namespaces. With a larger LTO testcase we run into this with a namespace DIE not readily available but I'm not sure the issue isn't latent with non-LTO. The original code was added with the fix for PR44188 which had a lengthy discussion and various patch variants but this very piece of change didn't have an explanation and why it didn't use scope_die_for. The single testcase added still passes after the patch. Bootstraped on x86_64-unknown-linux-gnu, testing in progress. OK for trunk? Thanks, Richard. 2018-07-11 Richard Biener PR debug/86452 * dwarf2out.c (gen_type_die_with_usage): Use scope_die_for instead of get_context_die. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 262551) +++ gcc/dwarf2out.c (working copy) @@ -25378,11 +25378,8 @@ gen_type_die_with_usage (tree type, dw_d generate debug info for the typedef. */ if (is_naming_typedef_decl (TYPE_NAME (type))) { - /* Use the DIE of the containing namespace as the parent DIE of - the type description DIE we want to generate. */ - if (DECL_CONTEXT (TYPE_NAME (type)) - && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL) - context_die = get_context_die (DECL_CONTEXT (TYPE_NAME (type))); + /* Give typedefs the right scope. */ + context_die = scope_die_for (type, context_die); gen_decl_die (TYPE_NAME (type), NULL, NULL, context_die); return;