This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR11679: ICE in finish_file, at cp/decl2.c:2727: varrayout of bounds in --enable-checking mode
- From: Raja R Harinath <harinath at cs dot umn dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 27 Jul 2003 00:04:31 -0500
- Subject: Re: [PATCH] PR11679: ICE in finish_file, at cp/decl2.c:2727: varrayout of bounds in --enable-checking mode
- Cancel-lock: sha1:VL4o2+rxbWDJuDvj7OVO8CAUyZE=
- Organization: Dept. of Computer Science, Univ. of Minnesota
- References: <d9brvgfuky.fsf@cs.umn.edu>
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