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]

Re: [PATCH] PR11679: ICE in finish_file, at cp/decl2.c:2727: varrayout of bounds in --enable-checking mode


Hi,

Raja R Harinath <harinath@cs.umn.edu> writes:
[snip]
> Given the current implementation of varray.h, it leads me to think
> that the usage of one-past-the-end pointers are not allowed, and so a
> technique like in the patch has to be implemented.

I think we'll need the slightly more paranoid patch below, unless we
know for sure that 'unemitted_tinfo_decls' will be non-empty at that
point.

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu

Index: gcc/cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.648
diff -c -p -r1.648 decl2.c
*** gcc/cp/decl2.c	19 Jul 2003 16:09:46 -0000	1.648
--- gcc/cp/decl2.c	27 Jul 2003 05:01:07 -0000
*************** finish_file ()
*** 2723,2734 ****
    	 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
--- 2723,2738 ----
    	 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_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]