aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2010-08-04 16:32:08 -0700
committerRichard Henderson <rth@gcc.gnu.org>2010-08-04 16:32:08 -0700
commite78f1a3f6710a19026c9746cdea6a7df25956bba (patch)
tree13236b211e435781d93b695c641cf2855a836389 /gcc
parentfde157f2ed3550acb3de83440e33c919cf7942c0 (diff)
downloadgcc-e78f1a3f6710a19026c9746cdea6a7df25956bba.zip
gcc-e78f1a3f6710a19026c9746cdea6a7df25956bba.tar.gz
gcc-e78f1a3f6710a19026c9746cdea6a7df25956bba.tar.bz2
re PR debug/45171 (Invalid DWARF...DIE 0x00006a1d has multiple AT_byte_size attributes.)
PR debug/45171 * dwarf2out.c (gen_typedef_die): Don't re-generate the die of an is_naming_typedef_decl. From-SVN: r162882
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/dwarf2out.c32
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/typedef4.C10
3 files changed, 33 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6ed4e68..84ef887 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-04 Richard Henderson <rth@redhat.com>
+
+ PR debug/45171
+ * dwarf2out.c (gen_typedef_die): Don't re-generate the die of
+ an is_naming_typedef_decl.
+
2010-08-04 Bernd Schmidt <bernds@codesourcery.com>
PR rtl-optimization/45162
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 95de468..651642a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19785,22 +19785,24 @@ gen_typedef_die (tree decl, dw_die_ref context_die)
type = TREE_TYPE (decl);
if (is_naming_typedef_decl (TYPE_NAME (type)))
- /*
- Here, we are in the case of decl being a typedef naming
- an anonymous type, e.g:
+ {
+ /* Here, we are in the case of decl being a typedef naming
+ an anonymous type, e.g:
typedef struct {...} foo;
- In that case TREE_TYPE (decl) is not a typedef variant
- type and TYPE_NAME of the anonymous type is set to the
- TYPE_DECL of the typedef. This construct is emitted by
- the C++ FE.
-
- TYPE is the anonymous struct named by the typedef
- DECL. As we need the DW_AT_type attribute of the
- DW_TAG_typedef to point to the DIE of TYPE, let's
- generate that DIE right away. add_type_attribute
- called below will then pick (via lookup_type_die) that
- anonymous struct DIE. */
- gen_tagged_type_die (type, context_die, DINFO_USAGE_DIR_USE);
+ In that case TREE_TYPE (decl) is not a typedef variant
+ type and TYPE_NAME of the anonymous type is set to the
+ TYPE_DECL of the typedef. This construct is emitted by
+ the C++ FE.
+
+ TYPE is the anonymous struct named by the typedef
+ DECL. As we need the DW_AT_type attribute of the
+ DW_TAG_typedef to point to the DIE of TYPE, let's
+ generate that DIE right away. add_type_attribute
+ called below will then pick (via lookup_type_die) that
+ anonymous struct DIE. */
+ if (!TREE_ASM_WRITTEN (type))
+ gen_tagged_type_die (type, context_die, DINFO_USAGE_DIR_USE);
+ }
}
add_type_attribute (type_die, type, TREE_READONLY (decl),
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/typedef4.C b/gcc/testsuite/g++.dg/debug/dwarf2/typedef4.C
new file mode 100644
index 0000000..2879f60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/typedef4.C
@@ -0,0 +1,10 @@
+// Origin: PR debug/45171
+// { dg-options "-g -dA -fno-eliminate-unused-debug-types" }
+// { dg-do compile }
+
+// There should be 2 real instances of byte_size -- one for the
+// struct and one for "int". The other two instances are from
+// the comments in the .debug_abbrev section.
+// { dg-final { scan-assembler-times "DW_AT_byte_size" 4 } }
+
+typedef struct { int a, b; } x;