Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/98055/?format=api
{ "id": 98055, "url": "http://patchwork.ozlabs.org/api/patches/98055/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/m38vtm97i1.fsf@redhat.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<m38vtm97i1.fsf@redhat.com>", "list_archive_url": null, "date": "2011-05-31T16:09:42", "name": "Fix PR debug/49130", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6177556583bd0510aebae9ebce0b2de0642da348", "submitter": { "id": 4376, "url": "http://patchwork.ozlabs.org/api/people/4376/?format=api", "name": "Dodji Seketeli", "email": "dodji@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/m38vtm97i1.fsf@redhat.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/98055/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/98055/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-293274-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list gcc-patches@gcc.gnu.org" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\tby ozlabs.org (Postfix) with SMTP id 0BF68B6F72\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 1 Jun 2011 02:10:19 +1000 (EST)", "(qmail 587 invoked by alias); 31 May 2011 16:10:15 -0000", "(qmail 562 invoked by uid 22791); 31 May 2011 16:10:12 -0000", "from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by\n\tsourceware.org (qpsmtpd/0.43rc1) with ESMTP;\n\tTue, 31 May 2011 16:09:45 +0000", "from int-mx10.intmail.prod.int.phx2.redhat.com\n\t(int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])\tby\n\tmx1.redhat.com (8.14.4/8.14.4) with ESMTP id\n\tp4VG9ibn021656\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA\n\tbits=256 verify=OK)\tfor <gcc-patches@gcc.gnu.org>;\n\tTue, 31 May 2011 12:09:45 -0400", "from localhost (ovpn-113-56.phx2.redhat.com [10.3.113.56])\tby\n\tint-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4)\n\twith ESMTP id p4VG9hXA024744\t(version=TLSv1/SSLv3\n\tcipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\n\tTue, 31 May 2011 12:09:44 -0400", "by localhost (Postfix, from userid 500)\tid 9501B8E604B;\n\tTue, 31 May 2011 18:09:42 +0200 (CEST)" ], "X-SWARE-Spam-Status": "No, hits=-5.8 required=5.0\ttests=AWL, BAYES_00,\n\tRCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD", "X-Spam-Check-By": "sourceware.org", "From": "Dodji Seketeli <dodji@redhat.com>", "To": "Jason Merrill <jason@redhat.com>", "Cc": "Tom Tromey <tromey@redhat.com>, GCC Patches <gcc-patches@gcc.gnu.org>", "Subject": "[PATCH] Fix PR debug/49130", "X-URL": "http://www.redhat.com", "Mail-Followup-To": "Jason Merrill <jason@redhat.com>,\n\tTom Tromey\t<tromey@redhat.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>", "Date": "Tue, 31 May 2011 18:09:42 +0200", "Message-ID": "<m38vtm97i1.fsf@redhat.com>", "User-Agent": "Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=us-ascii", "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>", "Sender": "gcc-patches-owner@gcc.gnu.org" }, "content": "Hello,\n\nIn this PR an integer constant which type is a typedef based on an\ninteger might be pretty-printed differently from the way the mangler\nwould have represented it. As a result, the DW_AT_name representing\nthe constant might be gratuitously be different from the linkage name.\n\nIn the example accompanying the patch:\n\nThe DW_AT_name of S<foo> is \"S<2048u>\", whereas the name of S<foo>.f\n(as demangled from the linkage name) is S<2048ul>::f(unsigned long),\nrightfully implying that the name of S<foo> should be \"2048ul\" instead\nof \"2048u\".\n\nThe reason of this is that pp_c_integer_constant compares the type to\npretty print with a set of integer constant types, using pointer\ncomparison. When the type to pretty print is actually a typedef, that\npointer comparison can fail even if the types are otherwise\nequivalent.\n\nThus the patch considers the canonical type of the type to\npretty-print, when it is present.\n\nTested on x86_64-unknown-linux-gnu against trunk.\n\ngcc/c-family/\n\n\t* c-pretty-print.c (pp_c_integer_constant): Consider the canonical\n\ttype when using pointer comparison to compare types.\n\ngcc/testsuite/\n\n\t* g++.dg/debug/dwarf2/integer-typedef.C: New test.\n---\n gcc/c-family/c-pretty-print.c | 7 ++++-\n .../g++.dg/debug/dwarf2/integer-typedef.C | 28 ++++++++++++++++++++\n 2 files changed, 34 insertions(+), 1 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C", "diff": "diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c\nindex e418903..518b373 100644\n--- a/gcc/c-family/c-pretty-print.c\n+++ b/gcc/c-family/c-pretty-print.c\n@@ -901,7 +901,12 @@ pp_c_string_literal (c_pretty_printer *pp, tree s)\n static void\n pp_c_integer_constant (c_pretty_printer *pp, tree i)\n {\n- tree type = TREE_TYPE (i);\n+ /* We are going to compare the type of I to other types using\n+ pointer comparison so we need to use its canonical type. */\n+ tree type =\n+ TYPE_CANONICAL (TREE_TYPE (i))\n+ ? TYPE_CANONICAL (TREE_TYPE (i))\n+ : TREE_TYPE (i);\n \n if (TREE_INT_CST_HIGH (i) == 0)\n pp_wide_integer (pp, TREE_INT_CST_LOW (i));\ndiff --git a/gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C b/gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C\nnew file mode 100644\nindex 0000000..42b3c99\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C\n@@ -0,0 +1,28 @@\n+// Origin: PR debug/49130\n+// { dg-options \"-g -dA\" }\n+\n+typedef long unsigned int size_t;\n+static const size_t foo = 2048;\n+\n+template<size_t size>\n+struct S\n+{\n+ void f(size_t);\n+};\n+\n+template<size_t size>\n+inline void\n+S<size>::f(size_t)\n+{\n+ size_t i = size;\n+}\n+\n+int\n+main()\n+{\n+ S<foo> s1;\n+ s1.f(10);\n+}\n+\n+// { dg-final {scan-assembler-times \"\\[^\\n\\r\\]*DW_AT_name: \\\"S<2048ul>\\\"\" 1 } }\n+// { dg-final {scan-assembler-times \"\\[^\\n\\r\\]*DW_AT_MIPS_linkage_name: \\\"_ZN1SILm2048EE1fEm\\\"\" 1 } }\n", "prefixes": [] }