From b4592b92ac97f5573c08b16d115c89d3b8157c39 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Tue, 7 Jun 2011 11:12:50 +0000 Subject: [PATCH] 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 --- gcc/c-family/ChangeLog | 6 ++++ gcc/c-family/c-pretty-print.c | 9 ++++-- gcc/testsuite/ChangeLog | 5 ++++ .../g++.dg/debug/dwarf2/integer-typedef.C | 28 +++++++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/integer-typedef.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 38a6d5560ba..f0592f5390b 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2011-06-07 Dodji Seketeli + + 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 * 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 e41890370a1..1be3dd47494 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 @@ -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 a83814a8990..179569065eb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-06-07 Dodji Seketeli + + PR debug/49130 + * g++.dg/debug/dwarf2/integer-typedef.C: New test. + 2011-06-07 Andrew Stubbs * 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 00000000000..42b3c997f38 --- /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 +struct S +{ + void f(size_t); +}; + +template +inline void +S::f(size_t) +{ + size_t i = size; +} + +int +main() +{ + S 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 } } -- 2.30.2