public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nikolay at etnus dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/19954] New: Compiler emits incomplete structure type
Date: Mon, 14 Feb 2005 20:42:00 -0000	[thread overview]
Message-ID: <20050214181126.19954.nikolay@etnus.com> (raw)

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	other threads:[~2005-02-14 18:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-14 20:42 nikolay at etnus dot com [this message]
2005-02-14 20:49 ` [Bug debug/19954] " pinskia at gcc dot gnu dot org
2005-03-21 16:26 ` drow at gcc dot gnu dot org
2005-09-26  0:43 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050214181126.19954.nikolay@etnus.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).