This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/1026: regression in casts.exp from gcc 3.2.1 to gcc gcc-3_3-branch%20030128


The following reply was made to PR c++/1026; it has been noted by GNATS.

From: Michael Elizabeth Chastain <mec@shout.net>
To: gdb-gnats@sources.redhat.com
Cc:  
Subject: Re: c++/1026: regression in casts.exp from gcc 3.2.1 to gcc gcc-3_3-branch%20030128
Date: Sat, 8 Feb 2003 09:18:50 -0600

 Let's take a closer look at the difference in stabs from 3.2.1 to
 gcc-3_3-branch:
 
   # gcc 3.2.1
   .stabs
     "B:Tt(1,10)			# class B
       =s8			#   size 8
       !1,020,(1,1);		#   : public class A {
       b:(0,1),32,32;		#     int b;
 
   # gcc gcc-3_3-branch%20030204
   .stabs
     "B:Tt(1,10)			# class B
       =s8			#   size 8
       !1,020,(1,1);		#   : public class A {
       :(1,11)=s4;,0,32;		#     struct {} size 4;
       b:(0,1),32,32;		#     int b;
 
 gcc gcc-3_3-branch adds this new field to the class:
 
   :(1,11)=s4;,0,32;
 
 Literally, this is a field with no name, new type (1,11),
 structure of size 4, located at bit offset 0, size 32.
 It looks like gcc emits these anonymous fields to cover the
 base classes of each class.
 
 Look at the output of ptype:
 
   # gcc gcc-3_3-branch%20030204
   (gdb) ptype B
   type = class B : public A {
     public:
       struct {
 	  <no data fields>
       };
       int b;
 
       B & operator=(B const&);
       B(B const&);
       B(int, int);
   }
 
 Note that gdb still knows the proper location of 'b', because each field
 has an absolute bit offset.  The problem is that gdb prints extra crap
 about the anonymous fields.
 
   # gcc gcc-3_3-branch%20030204
   (gdb) print *b
   $1 = {<A> = {a = 42}, {<No data fields>}, b = 1729}
 
 We have to make a choice:
 
   (1) change gdb to handle these base class anonymous fields so that
       they don't generate extra crap in the output
 
   (2) file a PR against gcc to stop emitting the base class anonymous fields
 
   (3) let people suffer with tons of {<No data fields>} in the output
 
 Note that this happens only with stabs+; dwarf-2 is fine.
 
 Michael C


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]