------- Comment #3 from jakub at gcc dot gnu dot org  2009-03-10 09:43 -------
What's the point in generating the DIE in gen_tagged_type_instantiation_die?
Seems we are generating that since like forever (that function existed already
when dwarf2out.c was added to the repository in 1996), but as it doesn't
equate_type_number_to_die, unless -fno-eliminate-unused-debug-types it is
always pruned anyway and even if it is not pruned, it is never used by
anything.
If there is an inline function which defines some type, variables of that type
will be typically emitted inside of the abstract DW_TAG_subprogram DIE and vars
elsewhere will just have DW_AT_abstract_origin pointing to those, not defining
the type at all.
Also, gen_tagged_type_instantiation_die types can be emitted many times.
Say:
struct S { int i; };

extern void baz (void *);

inline void
bar (void *x, unsigned long y)
{
  union { struct S a[y]; } *u = x;
  baz (&u);
}

void
foo (void *x, unsigned long y)
{
  bar (x, y);
}

at -fno-eliminate-unused-debug-types -g -O2 -dA has 2:
        .uleb128 0x12   # (DIE (0xda) DW_TAG_union_type)
        .long   0x6b    # DW_AT_abstract_origin
        .uleb128 0x12   # (DIE (0xdf) DW_TAG_union_type)
        .long   0x6b    # DW_AT_abstract_origin
(both unused).  So before teaching gen_tagged_type_instantiation_die to handle
quals (add DW_TAG_const_type or DW_TAG_volatile_type around it), I'd like to
question if gen_tagged_type_instantiation_die shouldn't be nuked instead.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot org


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

Reply via email to