This is a readelf output of test program. The variable in question is 
 Derived1 d1;

<0><9dd>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 492    
     DW_AT_producer    : GNU C++ 3.4.3  
     DW_AT_language    : 4      (C++)
     DW_AT_name        : ../../src/tx_basic_class.cxx   
<3><a86>: Abbrev Number: 4 (DW_TAG_variable)
     DW_AT_name        : d1     
     DW_AT_decl_file   : 1      
     DW_AT_decl_line   : 4      
     DW_AT_type        : <ad5>  
     DW_AT_location    : 2 byte block: 91 68    (DW_OP_fbreg: -24; )
<1><ad5>: Abbrev Number: 6 (DW_TAG_structure_type)
     DW_AT_sibling     : <b06>  
     DW_AT_name        : Derived1       
     DW_AT_declaration : 1      
^^^^^^^^^
But there is no defining declaration of this class other than in different CU: 

<0><ef7>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 1016   
     DW_AT_producer    : GNU C++ 3.4.3  
     DW_AT_language    : 4      (C++)
     DW_AT_name        : ../../src/Derived1.cxx 
<1><f76>: Abbrev Number: 2 (DW_TAG_structure_type)
     DW_AT_sibling     : <10b6> 
     DW_AT_name        : (indirect string, offset: 0x6ba): Derived1     
     DW_AT_byte_size   : 16     
     DW_AT_decl_file   : 2      
     DW_AT_decl_line   : 5      
     DW_AT_containing_type: <11c4>      

But this is clearly wrong, because this declaration have no connection with
previous one exept for the name. And in more complex examples it just plain
wrong and is not working.

Example files: 
-------------------------------------------------
//Derived1.hxx

class Derived1{
public:
  Derived1(int size=5);
  virtual ~Derived1() { delete []myPointer; } 
  virtual int getId(); 
  virtual float* getData(int);
private:
  int mySize;
  int myId;
  float* myPointer;
};
---------------------------
//Derived111.cxx
#include "Derived111.hxx"
Derived1::Derived1(int size){
  mySize=size;
  myId=2;
  myPointer=new float[mySize];
  for(int i=0;i<mySize;i++)
    myPointer[i]=i+1;
}
int Derived1::getId(){
  return myId;
}
float* Derived1::getData(int dummy){
 dummy=11;
 return myPointer;
}
--------------------------
// main
#include "Derived111.hxx"

int main(){
 Derived1 d1; 
 int m=d1.getId();
 float* pt = d1.getData(1);     /* set breakpoint here */
 float* dummy_bp=pt;

 Derived1* dp = &d1;
 pt = dp->getData(1);
}
------------------------------------

-- 
           Summary: Compiler emits incomplete structure type
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nikolay at etnus dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to