aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2011-06-07 11:12:50 +0000
committerDodji Seketeli <dodji@gcc.gnu.org>2011-06-07 13:12:50 +0200
commitb4592b92ac97f5573c08b16d115c89d3b8157c39 (patch)
treefea88d620a009b1f7a315b8bb2324aecb169c193 /gcc
parentf373314fb8acc3d6dab8670008dc9338171f8ab4 (diff)
downloadgcc-b4592b92ac97f5573c08b16d115c89d3b8157c39.zip
gcc-b4592b92ac97f5573c08b16d115c89d3b8157c39.tar.gz
gcc-b4592b92ac97f5573c08b16d115c89d3b8157c39.tar.bz2
re PR debug/49130 (discrepancies between DW_AT_name and demangler)
Fix PR debug/49130 gcc/c-family/ * c-pretty-print.c (pp_c_integer_constant): Consider the canonical type when using pointer comparison to compare types. gcc/testsuite/ * g++.dg/debug/dwarf2/integer-typedef.C: New test. From-SVN: r174742
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-pretty-print.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C28
4 files changed, 46 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 38a6d55..f0592f5 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-07 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/49130
+ * c-pretty-print.c (pp_c_integer_constant): Consider the canonical
+ type when using pointer comparison to compare types.
+
2011-06-02 Jonathan Wakely <jwakely.gcc@gmail.com>
* c.opt: Add -Wdelete-non-virtual-dtor.
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index e418903..1be3dd47 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -1,5 +1,5 @@
/* Subroutines common to both C and C++ pretty-printers.
- Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
@@ -901,7 +901,12 @@ pp_c_string_literal (c_pretty_printer *pp, tree s)
static void
pp_c_integer_constant (c_pretty_printer *pp, tree i)
{
- tree type = TREE_TYPE (i);
+ /* We are going to compare the type of I to other types using
+ pointer comparison so we need to use its canonical type. */
+ tree type =
+ TYPE_CANONICAL (TREE_TYPE (i))
+ ? TYPE_CANONICAL (TREE_TYPE (i))
+ : TREE_TYPE (i);
if (TREE_INT_CST_HIGH (i) == 0)
pp_wide_integer (pp, TREE_INT_CST_LOW (i));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a83814a..1795690 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-07 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/49130
+ * g++.dg/debug/dwarf2/integer-typedef.C: New test.
+
2011-06-07 Andrew Stubbs <ams@codesourcery.com>
* gcc.target/arm/smlatb-1.c: New file.
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C b/gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C
new file mode 100644
index 0000000..42b3c99
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C
@@ -0,0 +1,28 @@
+// Origin: PR debug/49130
+// { dg-options "-g -dA" }
+
+typedef long unsigned int size_t;
+static const size_t foo = 2048;
+
+template<size_t size>
+struct S
+{
+ void f(size_t);
+};
+
+template<size_t size>
+inline void
+S<size>::f(size_t)
+{
+ size_t i = size;
+}
+
+int
+main()
+{
+ S<foo> s1;
+ s1.f(10);
+}
+
+// { dg-final {scan-assembler-times "\[^\n\r\]*DW_AT_name: \"S<2048ul>\"" 1 } }
+// { dg-final {scan-assembler-times "\[^\n\r\]*DW_AT_MIPS_linkage_name: \"_ZN1SILm2048EE1fEm\"" 1 } }