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

           Summary: -gdwarf-4 bug
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: tro...@gcc.gnu.org


Compile this program with '-gdwarf-4':

class C { public: C() { } };

namespace X {
  typedef struct {
    C m;
  } t2;

  t2 v;
};


The definition of the constructor for t2 is emitted weirdly.
I see:

 <1><72>: Abbrev Number: 21 (DW_TAG_structure_type)
    <73>   DW_AT_declaration : 1    
    <73>   DW_AT_sibling     : <0x80>    
 <2><77>: Abbrev Number: 22 (DW_TAG_subprogram)
    <78>   DW_AT_name        : t2    
    <7b>   DW_AT_artificial  : 1    
    <7b>   DW_AT_declaration : 1    
    <7b>   DW_AT_object_pointer: <0x1b5>    

... but note that there is no way to associate this with the type 't2'.

If I use plain -g, I see what I would expect: the constructor is a child
of the type 't2':

 <1><79>: Abbrev Number: 10 (DW_TAG_structure_type)
    <7a>   DW_AT_specification: <0x5d>    
    <7e>   DW_AT_byte_size   : 1    
    <7f>   DW_AT_decl_file   : 1    
    <80>   DW_AT_decl_line   : 4    
    <81>   DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2c): N1X2t2E    
    <85>   DW_AT_sibling     : <0xa7>    
 <2><89>: Abbrev Number: 11 (DW_TAG_member)
    <8a>   DW_AT_name        : m    
    <8c>   DW_AT_decl_file   : 1    
    <8d>   DW_AT_decl_line   : 5    
    <8e>   DW_AT_type        : <0x31>    
    <92>   DW_AT_data_member_location: 2 byte block: 23 0    
(DW_OP_plus_uconst: 0)
 <2><95>: Abbrev Number: 12 (DW_TAG_subprogram)
    <96>   DW_AT_name        : t2    
    <99>   DW_AT_artificial  : 1    
    <9a>   DW_AT_declaration : 1    
    <9b>   DW_AT_object_pointer: <0x9f>

Reply via email to