This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

fix g++.old-deja/g++.eh/catch5p.C


For some reason this isn't failing on mainline at present,
but it is with one of my patches applied.  The problem is:

z.c:154: internal compiler error: virtual array RTTI decls[10]: element 10 \
out of bounds in finish_file, at cp/decl2.c:2735

Fixed thus.


r~


        * decl2.c (finish_file): Avoid out-of-bounds array reference
        during memmove.

Index: decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.670
diff -u -p -c -r1.670 decl2.c
*** decl2.c	8 Sep 2003 18:46:15 -0000	1.670
--- decl2.c	10 Sep 2003 02:36:32 -0000
*************** finish_file ()
*** 2731,2742 ****
    	 them to the beginning of the array, then get rid of the
    	 leftovers.  */
        n_new = VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls) - n_old;
!       memmove (&VARRAY_TREE (unemitted_tinfo_decls, 0),
!   	       &VARRAY_TREE (unemitted_tinfo_decls, n_old),
!   	       n_new * sizeof (tree));
        memset (&VARRAY_TREE (unemitted_tinfo_decls, n_new),
!   	      0,
!   	      n_old * sizeof (tree));
        VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls) = n_new;
  
        /* The list of objects with static storage duration is built up
--- 2731,2742 ----
    	 them to the beginning of the array, then get rid of the
    	 leftovers.  */
        n_new = VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls) - n_old;
!       if (n_new)
! 	memmove (&VARRAY_TREE (unemitted_tinfo_decls, 0),
! 		 &VARRAY_TREE (unemitted_tinfo_decls, n_old),
! 		 n_new * sizeof (tree));
        memset (&VARRAY_TREE (unemitted_tinfo_decls, n_new),
!   	      0, n_old * sizeof (tree));
        VARRAY_ACTIVE_SIZE (unemitted_tinfo_decls) = n_new;
  
        /* The list of objects with static storage duration is built up


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