From 0e9a4c0161a49fa966841cb4dcbfbc4f63eeb4bb Mon Sep 17 00:00:00 2001 From: dodji Date: Tue, 7 Jun 2011 11:12:50 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174742 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-family/c-pretty-print.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gcc/c-family/c-pretty-print.c') 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)); -- cgit v1.2.1