http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51567

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-15 
14:42:19 UTC ---
5007      gcc_assert (child->die_parent == parent
5008                  || (child->die_parent
5009                      == get_AT_ref (parent, DW_AT_specification)));

we have

(gdb) call debug_dwarf_die (child)
DIE    0: DW_TAG_member (0x7ffff5b6c2d0)
  abbrev id: 0 offset: 0 mark: 0
  DW_AT_name: "_M_cur"
  DW_AT_decl_file: "t.ii" (1)
  DW_AT_decl_line: 2
  DW_AT_type: die -> 0 (0x7ffff5b6c320)
  DW_AT_data_member_location: location descriptor

(gdb) call debug_dwarf_die (parent)
DIE    0: DW_TAG_structure_type (0x7ffff5b6c8c0)
  abbrev id: 0 offset: 0 mark: 0
  DW_AT_name: "iterator"
  DW_AT_byte_size: 8
  DW_AT_decl_file: "t.ii" (1)
  DW_AT_decl_line: 1

so somehow it messes up parent, which should be a typedef DIE(?).  We generate
it through

#0  0x000000000062a089 in gen_struct_or_union_type_die (type=0x7ffff5b5fc78, 
    context_die=0x7ffff5b6c820, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18582
#1  0x000000000062b139 in gen_tagged_type_die (type=0x7ffff5b5fc78, 
    context_die=0x7ffff5b6c820, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18810
#2  0x000000000062ab4f in gen_typedef_die (decl=0x7ffff5b682e0, 
    context_die=0x7ffff5b6c820)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18719
#3  0x000000000062ecbd in gen_decl_die (decl=0x7ffff5b682e0, origin=0x0, 
    context_die=0x7ffff5b6c820)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:19523
#4  0x000000000062ba99 in gen_type_die_with_usage (type=0x7ffff5b5fc78, 
    context_die=0x7ffff5b6c820, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18873
#5  0x000000000062bfc8 in gen_type_die (type=0x7ffff5b5fc78, 
    context_die=0x7ffff5b6c820)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18999
#6  0x000000000062f032 in gen_decl_die (decl=0x7ffff5a45428, origin=0x0, 
    context_die=0x7ffff5b6c820)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:19574
#7  0x00000000006297dd in gen_member_die (type=0x7ffff5b5fb28, 
    context_die=0x7ffff5b6c820)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18532
#8  0x000000000062a484 in gen_struct_or_union_type_die (type=0x7ffff5b5fb28, 
    context_die=0x7ffff5b6c780, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18624
#9  0x000000000062b139 in gen_tagged_type_die (type=0x7ffff5b5fb28, 
    context_die=0x7ffff5b6c780, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18810
#10 0x000000000062be2d in gen_type_die_with_usage (type=0x7ffff5b5fb28, 
    context_die=0x7ffff5b6c780, usage=DINFO_USAGE_DIR_USE)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18960
#11 0x000000000062bfc8 in gen_type_die (type=0x7ffff5b5fb28, 
    context_die=0x7ffff5b6c780)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18999
#12 0x000000000060960d in modified_type_die (type=0x7ffff5b5fb28, 
    is_const_type=0, is_volatile_type=0, context_die=0x7ffff5b6c780)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:9835
#13 0x000000000061f7de in add_type_attribute (object_die=0x7ffff5b6c7d0, 
    type=0x7ffff5b5fb28, decl_const=0, decl_volatile=0, 
    context_die=0x7ffff5b6c780)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:16136
#14 0x000000000062946d in gen_inheritance_die (binfo=0x7ffff5b650c0, 
    access=0x7ffff5a2b528, context_die=0x7ffff5b6c780)
    at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:18464
...

I think it happens because we very likely merge the two types
named 'iterator' (_Deque_base::iterator and deque::iterator).
Which is because gimple.c:compare_type_names_p simply looks
through the TYPE_DECLs to the IDENTIFIER_NODEs.  It probably
should compare the DECL_CONTEXT of the TYPE_DECLs as well
(but if they are a TREE_TYPE that creates new members of the
SCC we have to visit ...)

Fixing that fixes this bug.

Reply via email to