This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: dbxout.c stabs output problem


I have found an explanation for the nested definitions, e.g.
	.stabs "PCHAR:t51=52=*50",128,0,193,0
This occurs because of the way gcc represents types internally.  The extra
number isn't completely spurious as we originally thought, because gcc shares
the pointer-to type among similar types.  E.g, given
        typedef int INT;
        typedef INT *foo;
        typedef INT *bar;
We get debug output
.stabs "INT:t20=1",128,0,1,0
.stabs "foo:t21=22=*20",128,0,2,0
.stabs "bar:t23=22",128,0,3,0
Changing this back to the old form would require adding some code to handle
pointer-to types specially.  Since this is a valid stab string, my preference
is to leave this alone to avoid special case code.

I have also figured out what is going on with array ranges, e.g.
	.stabs "STR8:t83=84=ar0;0;7;50",128,0,235,0
This is clearly incorrect, since it is defining a range using an undefined
type 0.  This is a bug in dbxout_range_types.  The intent here was that
integral non-subrange types should be defined in terms of themselves, so that
we can distinguish subrange from non-subrange types.  E.g. we want
	.stabs "byte:t7=r7;-128;127;",128,0,0,0
if byte it isn't a subrange type.  This acccidentallly broke C arrays which
use anonymous sub-range types.  I have installed the following patch to
fix this.

Thu Jul 23 18:53:20 1998  Jim Wilson  <wilson@cygnus.com>

	* dbxout.c (dbxout_range_type): Only call dbxout_type_index for
	already defined type.

Index: dbxout.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/dbxout.c,v
retrieving revision 1.161
diff -p -r1.161 dbxout.c
*** dbxout.c	1998/07/08 09:42:57	1.161
--- dbxout.c	1998/07/24 01:51:54
*************** dbxout_range_type (type)
*** 971,978 ****
  	 were defined to be sub-ranges of int.  Unfortunately, this
  	 does not allow us to distinguish true sub-ranges from integer
  	 types.  So, instead we define integer (non-sub-range) types as
! 	 sub-ranges of themselves.  */
!       dbxout_type_index (type);
      }
    if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)
      {
--- 971,988 ----
  	 were defined to be sub-ranges of int.  Unfortunately, this
  	 does not allow us to distinguish true sub-ranges from integer
  	 types.  So, instead we define integer (non-sub-range) types as
! 	 sub-ranges of themselves.  This matters for Chill.  If this isn't
! 	 a subrange type, then we want to define it in terms of itself.
! 	 However, in C, this may be an anonymous integer type, and we don't
! 	 want to emit debug info referring to it.  Just calling
! 	 dbxout_type_index won't work anyways, because the type hasn't been
! 	 defined yet.  We make this work for both cases by checked to see
! 	 whether this is a defined type, referring to it if it is, and using
! 	 'int' otherwise.  */
!       if (TYPE_SYMTAB_ADDRESS (type) != 0)
! 	dbxout_type_index (type);
!       else
! 	dbxout_type_index (integer_type_node);
      }
    if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)
      {


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