Commit 34f3d643 by Dodji Seketeli Committed by Dodji Seketeli

re PR debug/46101 (ICE: in build_abbrev_table, at dwarf2out.c:10333 with…

re PR debug/46101 (ICE: in build_abbrev_table, at dwarf2out.c:10333 with -feliminate-dwarf2-dups -g)

Fix PR debug/46101

gcc/
	* dwarf2out.c (lookup_type_die_strip_naming_typedef): New
	function.
	(scope_die_for, gen_type_die_for_member): Replace uses of
	lookup_type_die with use of lookup_type_die_strip_naming_typedef.

gcc/testsuite/
	* g++.dg/debug/dwarf2/typedef5.C: New test

From-SVN: r167246
parent 7607219d
2010-11-29 Dodji Seketeli <dodji@redhat.com>
PR debug/46101
* dwarf2out.c (lookup_type_die_strip_naming_typedef): New
function.
(scope_die_for, gen_type_die_for_member): Replace uses of
lookup_type_die with use of lookup_type_die_strip_naming_typedef.
2010-11-29 Iain Sandoe <iains@gcc.gnu.org> 2010-11-29 Iain Sandoe <iains@gcc.gnu.org>
* config/darwin.c (darwin_mergeable_string_section): Remove blank line. * config/darwin.c (darwin_mergeable_string_section): Remove blank line.
...@@ -6264,6 +6264,7 @@ static void remove_child_TAG (dw_die_ref, enum dwarf_tag); ...@@ -6264,6 +6264,7 @@ static void remove_child_TAG (dw_die_ref, enum dwarf_tag);
static void add_child_die (dw_die_ref, dw_die_ref); static void add_child_die (dw_die_ref, dw_die_ref);
static dw_die_ref new_die (enum dwarf_tag, dw_die_ref, tree); static dw_die_ref new_die (enum dwarf_tag, dw_die_ref, tree);
static dw_die_ref lookup_type_die (tree); static dw_die_ref lookup_type_die (tree);
static dw_die_ref lookup_type_die_strip_naming_typedef (tree);
static void equate_type_number_to_die (tree, dw_die_ref); static void equate_type_number_to_die (tree, dw_die_ref);
static hashval_t decl_die_table_hash (const void *); static hashval_t decl_die_table_hash (const void *);
static int decl_die_table_eq (const void *, const void *); static int decl_die_table_eq (const void *, const void *);
...@@ -8033,6 +8034,27 @@ lookup_type_die (tree type) ...@@ -8033,6 +8034,27 @@ lookup_type_die (tree type)
return TYPE_SYMTAB_DIE (type); return TYPE_SYMTAB_DIE (type);
} }
/* Like lookup_type_die, but if type is an anonymous type named by a
typedef[1], return the DIE of the anonymous type instead the one of
the naming typedef. This is because in gen_typedef_die, we did
equate the anonymous struct named by the typedef with the DIE of
the naming typedef. So by default, lookup_type_die on an anonymous
struct yields the DIE of the naming typedef.
[1]: Read the comment of is_naming_typedef_decl to learn about what
a naming typedef is. */
static inline dw_die_ref
lookup_type_die_strip_naming_typedef (tree type)
{
dw_die_ref die = lookup_type_die (type);
if (TREE_CODE (type) == RECORD_TYPE
&& die->die_tag == DW_TAG_typedef
&& is_naming_typedef_decl (TYPE_NAME (type)))
die = get_AT_ref (die, DW_AT_type);
return die;
}
/* Equate a DIE to a given type specifier. */ /* Equate a DIE to a given type specifier. */
static inline void static inline void
...@@ -17887,7 +17909,7 @@ scope_die_for (tree t, dw_die_ref context_die) ...@@ -17887,7 +17909,7 @@ scope_die_for (tree t, dw_die_ref context_die)
scope_die = comp_unit_die (); scope_die = comp_unit_die ();
} }
else else
scope_die = lookup_type_die (containing_scope); scope_die = lookup_type_die_strip_naming_typedef (containing_scope);
} }
else else
scope_die = context_die; scope_die = context_die;
...@@ -18714,7 +18736,7 @@ gen_type_die_for_member (tree type, tree member, dw_die_ref context_die) ...@@ -18714,7 +18736,7 @@ gen_type_die_for_member (tree type, tree member, dw_die_ref context_die)
gcc_assert (!decl_ultimate_origin (member)); gcc_assert (!decl_ultimate_origin (member));
push_decl_scope (type); push_decl_scope (type);
type_die = lookup_type_die (type); type_die = lookup_type_die_strip_naming_typedef (type);
if (TREE_CODE (member) == FUNCTION_DECL) if (TREE_CODE (member) == FUNCTION_DECL)
gen_subprogram_die (member, type_die); gen_subprogram_die (member, type_die);
else if (TREE_CODE (member) == FIELD_DECL) else if (TREE_CODE (member) == FIELD_DECL)
......
2010-11-29 Dodji Seketeli <dodji@redhat.com>
PR debug/46101
* g++.dg/debug/dwarf2/typedef5.C: New test
2010-11-29 Iain Sandoe <iains@gcc.gnu.org> 2010-11-29 Iain Sandoe <iains@gcc.gnu.org>
Mike Stump <mrs@gcc.gnu.org> Mike Stump <mrs@gcc.gnu.org>
......
// Origin: PR debug/46101
// { dg-options "-g -feliminate-dwarf2-dups" }
// { dg-do compile }
typedef struct
{
virtual void f () { }
} A;
A a;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment