[Bug debug/45088] New: pointer type information lost in debuginfo

tromey at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 26 19:25:00 GMT 2010


I'm using r162345 on x86 Fedora 13.

This test case comes from the gdb test suite.

struct A
{
  virtual ~A ();
  int a1;
};

A::~A()
{
  a1 = 800;
}

struct B : public A
{
  virtual ~B ();
  int b1;
  int b2;
};

B::~B()
{
  a1 = 900;
  b1 = 901;
  b2 = 902;
}

struct C : public B
{
  A *c1;
  A *c2;
};

// Stop the compiler from optimizing away data.
void refer (A *)
{
  ;
}

struct empty {};

// Stop the compiler from optimizing away data.
void refer (empty *)
{
  ;
}

int main (void)
{
  A alpha, *aap, *abp, *acp;
  B beta, *bbp;
  C gamma;
  empty e;

  alpha.a1 = 100;
  beta.a1 = 200; beta.b1 = 201; beta.b2 = 202;
  gamma.c1 = 0; gamma.c2 = (A *) ~0UL;

  aap = α refer (aap);
  abp = β  refer (abp);
  bbp = β  refer (bbp);
  acp = γ refer (acp);
  refer (&e);

  return 0;  // marker return 0
} // marker close brace


When I compile this I see that the type of the "c1" field is bad:

 <2><48>: Abbrev Number: 5 (DW_TAG_member)
    <49>   DW_AT_name        : c1       
    <4c>   DW_AT_decl_file   : 1        
    <4d>   DW_AT_decl_line   : 46       
    <4e>   DW_AT_type        : <0x116>  
    <52>   DW_AT_data_member_location: 2 byte block: 23 10     
(DW_OP_plus_uconst: 16)
[...]
 <1><116>: Abbrev Number: 11 (DW_TAG_pointer_type)
    <117>   DW_AT_byte_size   : 4       

That is, gcc claims that this field is a "void *", which is not the case.


-- 
           Summary: pointer type information lost in debuginfo
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tromey at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list