aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-02-26 16:58:57 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-02-26 16:58:57 +0100
commit095c7b3cbd4094944097b95b4a2c00d475b47ca9 (patch)
tree0688af0b1561fa59374d820b0b812f6ea4caeee9 /gcc
parenta1e205cf5156e77ea4be3b029b331dddaec8ebc0 (diff)
downloadgcc-095c7b3cbd4094944097b95b4a2c00d475b47ca9.zip
gcc-095c7b3cbd4094944097b95b4a2c00d475b47ca9.tar.gz
gcc-095c7b3cbd4094944097b95b4a2c00d475b47ca9.tar.bz2
re PR debug/43190 (Used pointer typedefs eliminated from debug info)
PR debug/43190 * function.c (used_types_insert): Don't skip through named pointer types. Don't use TYPE_MAIN_VARIANT if the original type has a name and it is different from the main variant's type. * c-c++-common/dwarf2/pr43190.c: New test. From-SVN: r157092
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/function.c13
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/c-c++-common/dwarf2/pr43190.c13
4 files changed, 34 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 08b7ab6..75f5aa7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2010-02-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/43190
+ * function.c (used_types_insert): Don't skip through named pointer
+ types. Don't use TYPE_MAIN_VARIANT if the original type has a name
+ and it is different from the main variant's type.
+
2010-02-26 Nick Clifton <nickc@redhat.com>
* config/rx/rx.md (sminsi3): Remove bogus alternative.
diff --git a/gcc/function.c b/gcc/function.c
index f85f780..60a429d 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1,7 +1,7 @@
/* Expands front end tree to back end RTL for GCC.
Copyright (C) 1987, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -5469,8 +5469,13 @@ void
used_types_insert (tree t)
{
while (POINTER_TYPE_P (t) || TREE_CODE (t) == ARRAY_TYPE)
- t = TREE_TYPE (t);
- t = TYPE_MAIN_VARIANT (t);
+ if (TYPE_NAME (t))
+ break;
+ else
+ t = TREE_TYPE (t);
+ if (TYPE_NAME (t) == NULL_TREE
+ || TYPE_NAME (t) == TYPE_NAME (TYPE_MAIN_VARIANT (t)))
+ t = TYPE_MAIN_VARIANT (t);
if (debug_info_level > DINFO_LEVEL_NONE)
{
if (cfun)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a35b053..e3971a8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-02-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/43190
+ * c-c++-common/dwarf2/pr43190.c: New test.
+
2010-02-26 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/37074:
diff --git a/gcc/testsuite/c-c++-common/dwarf2/pr43190.c b/gcc/testsuite/c-c++-common/dwarf2/pr43190.c
new file mode 100644
index 0000000..2cb1b70
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/dwarf2/pr43190.c
@@ -0,0 +1,13 @@
+/* PR debug/43190 */
+/* { dg-options "-gdwarf-2 -dA" } */
+/* { dg-final { scan-assembler "DW_TAG_structure_type\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"S\[^\\r\\n\]*DW_AT_name" } } */
+/* { dg-final { scan-assembler "DW_TAG_typedef\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"T\[^\\r\\n\]*DW_AT_name" } } */
+
+typedef struct S { int i; } *T;
+#define M(p) ((T) (p))
+
+void
+foo (void *p)
+{
+ M (p)->i++;
+}