From patchwork Thu Apr 18 18:49:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cary Coutant X-Patchwork-Id: 237718 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 120AF2C011C for ; Fri, 19 Apr 2013 04:49:25 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :to:subject:mime-version:content-type:content-transfer-encoding :message-id:from; q=dns; s=default; b=pLi2A7ASyzD+ceWC4Z5LLWhjkH jeW0Ze3wwZlGNjqjmkZWwz4/ywiij4PfdCi67vKLMu4pNpmJ9owTfK0LoZynKNRM Xklmbhj5qspjnHgsMUP3Ki5jgivNuD108put2KLzQmMU0oVRUL9V59+lByuOnEcO iS1owrWDkrxCh9zjY= 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 :to:subject:mime-version:content-type:content-transfer-encoding :message-id:from; s=default; bh=6ty9c2JjAcU53k9i8QBEfjFj/DI=; b= boWAMPwrNG+9cgpyjpcEnQWP/3ndQ5r+41opI7ZmawAfKLaj/rQXa1cqpkUOuy2w 4ln9a4n02XkN6o554BEPRtrHkoVBFI3R8OnvkMO8HQgowioKrGbHkLrKbVGwAa76 TY9nyMr/dliHTSO0tTjOnTZLlmQaDpWwSv+ehh/jE3c= Received: (qmail 7451 invoked by alias); 18 Apr 2013 18:49:18 -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 7441 invoked by uid 89); 18 Apr 2013 18:49:18 -0000 X-Spam-SWARE-Status: No, score=-5.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_GD autolearn=ham version=3.3.1 Received: from mail-qe0-f73.google.com (HELO mail-qe0-f73.google.com) (209.85.128.73) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 18 Apr 2013 18:49:15 +0000 Received: by mail-qe0-f73.google.com with SMTP id 1so330265qee.0 for ; Thu, 18 Apr 2013 11:49:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:to:subject:user-agent:mime-version:content-type :content-transfer-encoding:message-id:from:x-gm-message-state; bh=FZ5MX5JINOUWzglDWsMgl6e38U168kJBQ7cD9CWSlf0=; b=C53pKWf78o7Svf9SpkH5isiUPHiB7hVGdpgGviqIFt1lVlOVQO8hv8fqXj8gkvEncN VCVNHLJJy87HFTW17zH/5ClQW8+VM7CcRQ7/0wdmoEsbSLEbX+KzSlc9MXvvwvKU0q5x 9iI6FyWw8E4Ku/i5W5X3VIQ/vcLsMuKYGjCUCIshM4EvPy1dbwTHf8y8v9UKvzxB6N5h M+brmUvvZf6k9GQdkgmVG8eRx70oEsLBXFGE776eTu6x1fU7fju5ylGt5hFpnrw2C9js OSKfRBsesf33y+JWxFmq25o8oGsbxhNM85EKECfvTXN8aVJhy3nfmmYzTAOeufoz43ab cakA== X-Received: by 10.236.134.239 with SMTP id s75mr5732536yhi.39.1366310953882; Thu, 18 Apr 2013 11:49:13 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id c11si928165yhi.3.2013.04.18.11.49.13 (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Thu, 18 Apr 2013 11:49:13 -0700 (PDT) Received: from ccoutant.mtv.corp.google.com (ccoutant.mtv.corp.google.com [172.17.128.119]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 9A32231C268 for ; Thu, 18 Apr 2013 11:49:13 -0700 (PDT) Received: by ccoutant.mtv.corp.google.com (Postfix, from userid 62097) id 2BCCD160B65; Thu, 18 Apr 2013 11:49:13 -0700 (PDT) Date: Thu, 18 Apr 2013 11:49:13 -0700 To: gcc-patches@gcc.gnu.org Subject: [patch] Fix test failure with -fdebug-types-section. User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-Id: <20130418184913.2BCCD160B65@ccoutant.mtv.corp.google.com> From: ccoutant@google.com (Cary Coutant) X-Gm-Message-State: ALoCoQlaB5ZLgemo81417sod9VMEk/y8DQryLL2PW4y5Vh/ccCHR7JaOX91m3pz1yYIbG72K27J8uBEB1skqOIU39HwjAmTPrFUVUWxwP3eF7hXLpE+3WjSkExl8C2NzK5lzZBm6eA4laKZhhvNYOZDY45tAzrBbZZUafyUNPd/TmTUdNQT8apS0JSjqYPVh5TaAdqfRIB0YfZcddCGzMv446pT6rnp885OFsBHLJuAWnis0FXls7OE= I'm committing the following patch to fix a debug test failure when -fdebug-types-section is on. With -fdebug-types-section, GCC fails to emit enumerators into the pubnames table when the enumerator type has been moved to a separate type unit. In output_pubnames, we're checking to see if the type has been pruned by checking die_mark, but at this point in the compilation, die_mark is set only for DIEs in the main compilation unit. I've changed the code to check for the die_perennial_p flag on the enumerator_type DIE. I've cloned the pubnames-2.C test case so that we test the pubnames table generation with both -fno-debug-types-section and -fdebug-types-section. Bootstrapped on x86_64 with no new regressions. -cary 2013-04-18 Cary Coutant gcc/ * dwarf2out.c (output_pubnames ): gcc/testsuite/ * g++.dg/debug/dwarf2/pubnames-2.C: Add -fno-debug-types-section. * g++.dg/debug/dwarf2/pubnames-3.C: New test case. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 198034) +++ gcc/dwarf2out.c (working copy) @@ -9018,11 +9018,13 @@ output_pubnames (vecdie->die_tag == DW_TAG_enumerator && !pub->die->die_mark) + if (pub->die->die_tag == DW_TAG_enumerator && + (pub->die->die_parent == NULL + || !pub->die->die_parent->die_perennial_p)) continue; /* We shouldn't see pubnames for DIEs outside of the main CU. */ - if (names == pubname_table) + if (names == pubname_table && pub->die->die_tag != DW_TAG_enumerator) gcc_assert (pub->die->die_mark); if (names != pubtype_table Index: gcc/testsuite/g++.dg/debug/dwarf2/pubnames-3.C =================================================================== --- gcc/testsuite/g++.dg/debug/dwarf2/pubnames-3.C (revision 0) +++ gcc/testsuite/g++.dg/debug/dwarf2/pubnames-3.C (revision 0) @@ -0,0 +1,193 @@ +// { dg-do compile } +// { dg-options "-gpubnames -gdwarf-4 -fdebug-types-section -std=c++0x -dA" } +// { dg-final { scan-assembler-times "\.section\[\t \]\[^\n\]*debug_pubnames" 1 } } +// { dg-final { scan-assembler "\"\\(anonymous namespace\\)\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::G_A\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::G_B\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::G_C\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::\\(anonymous namespace\\)\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"F_A\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"F_B\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"F_C\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"inline_func_1\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::c1::c1\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::c1::~c1\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::c1::val\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"check_enum\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"main\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"check\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"check \\>\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"check \\>\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"check \\>\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::val\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::val\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::val\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"__static_initialization_and_destruction_0\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::~c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::~c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2::~c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"anonymous_union_var\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::ci\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2v1\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2v2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2v3\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::c1v\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::\\(anonymous namespace\\)::one_anonymous_var\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"\\(anonymous namespace\\)::c1_count\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"\\(anonymous namespace\\)::c2_count\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"\\(anonymous namespace\\)::three\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"\\(anonymous namespace\\)::three::anonymous_three_var\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler-times "\.section\[\t \]\[^\n\]*debug_pubtypes" 1 } } +// { dg-final { scan-assembler "\"one::G\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::c1\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"int\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"one::c1\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"double\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"two::c2\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"F\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"anonymous_union_container\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } +// { dg-final { scan-assembler "\"bool\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } + +namespace +{ +int c1_count; +int c2_count; + +namespace three +{ +int anonymous_three_var; +} +}; + +namespace one +{ + +enum G +{ + G_A, + G_B, + G_C +}; + +namespace { +int one_anonymous_var; +} + +class c1 +{ + public: + static int count; + + c1() + { ++c1_count; } + + ~c1() + { + --c1_count; + } + + enum E + { + E_A, + E_B, + E_C, + }; + + int + val() + { return E_A; } +}; + +c1 c1v; +}; + +namespace two +{ +const int ci = 3; + +template +class c2 +{ + public: + c2(T t) + : t_(t) + { + ++c2_count; + } + + ~c2() + { --c2_count; } + + T + val() + { return this->t_; } + + T t_; +}; + +c2 c2v1(1); +c2 c2v2(2.0); +c2 c2v3(&ci); +}; + +enum F +{ + F_A, + F_B, + F_C +}; + +template +bool +check(C* c) +{ return c->val() == 0; } + +bool +check_enum(int i) +{ return i > 0; } + +struct anonymous_union_container { + union { + struct astruct { + int a; + }; + int b; + } u; +}; + +anonymous_union_container anonymous_union_var; + +#ifdef __GNUC__ +#define ALWAYS_INLINE __attribute__((always_inline)) +#else +#define ALWAYS_INLINE +#endif + +static inline ALWAYS_INLINE int +inline_func_1(int i) +{ return i * 17; } + +int +main() +{ + F f = F_A; + one::G g = one::G_A; + check_enum(f); + check_enum(g); + check(&one::c1v); + check(&two::c2v1); + check(&two::c2v2); + check(&two::c2v3); + anonymous_union_var.u.b = inline_func_1(3) - 51; + return anonymous_union_var.u.b; +} Index: gcc/testsuite/g++.dg/debug/dwarf2/pubnames-2.C =================================================================== --- gcc/testsuite/g++.dg/debug/dwarf2/pubnames-2.C (revision 198034) +++ gcc/testsuite/g++.dg/debug/dwarf2/pubnames-2.C (working copy) @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-gpubnames -gdwarf-4 -std=c++0x -dA" } +// { dg-options "-gpubnames -gdwarf-4 -fno-debug-types-section -std=c++0x -dA" } // { dg-final { scan-assembler-times "\.section\[\t \]\[^\n\]*debug_pubnames" 1 } } // { dg-final { scan-assembler "\"\\(anonymous namespace\\)\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } } // { dg-final { scan-assembler "\"one\\\\0\"+\[ \t\]+\[#;/|@!]+\[ \t\]+external name" } }