This is the mail archive of the gcc@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]

No Subject



There is an off-by-one error in the stor-layout change of last Friday.  
The TYPE_BINFO_SIZE macro uses the vector element 6, which is the 7th 
element of the array.  This causes sporadic memory corruption problems.

<date>  Richard Earnshaw (rearnsha@arm.com)

	* stor-layout.c (layout_record): Fix off-by-one error when checking
	length of the TYPE_BINFO vector.

Index: stor-layout.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/stor-layout.c,v
retrieving revision 1.14
diff -p -r1.14 stor-layout.c
*** stor-layout.c	1998/05/15 18:56:10	1.14
--- stor-layout.c	1998/05/18 15:44:21
*************** layout_record (rec)
*** 551,557 ****
  
    /* Record the un-rounded size in the binfo node.  But first we check
       the size of TYPE_BINFO to make sure that BINFO_SIZE is available.  */
!   if (TYPE_BINFO (rec) && TREE_VEC_LENGTH (TYPE_BINFO (rec)) >= 6)
      TYPE_BINFO_SIZE (rec) = TYPE_SIZE (rec);
  
  #ifdef ROUND_TYPE_SIZE
--- 551,557 ----
  
    /* Record the un-rounded size in the binfo node.  But first we check
       the size of TYPE_BINFO to make sure that BINFO_SIZE is available.  */
!   if (TYPE_BINFO (rec) && TREE_VEC_LENGTH (TYPE_BINFO (rec)) > 6)
      TYPE_BINFO_SIZE (rec) = TYPE_SIZE (rec);
  
  #ifdef ROUND_TYPE_SIZE

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