re PR debug/49130 (discrepancies between DW_AT_name and demangler)
authorDodji Seketeli <dodji@redhat.com>
Tue, 7 Jun 2011 11:12:50 +0000 (11:12 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Tue, 7 Jun 2011 11:12:50 +0000 (13:12 +0200)
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

gcc/c-family/ChangeLog
gcc/c-family/c-pretty-print.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C [new file with mode: 0644]

index 38a6d5560bae4a6d3d61f63f1695e62356df93d6..f0592f5390bcef89d88dc4538de56d43dd719d4e 100644 (file)
@@ -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.
index e41890370a1756818e5bc8778b6809a62a7fa6ad..1be3dd4749448c031aec8c463088050526798ddd 100644 (file)
@@ -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));
index a83814a89900f8b0032366afda97f28fd327d2a6..179569065eb73f304bb79aac698233273c063eea 100644 (file)
@@ -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 (file)
index 0000000..42b3c99
--- /dev/null
@@ -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 } }