------- Additional Comments From nathan at codesourcery dot com  2005-09-27 
10:51 -------
Subject: Re:  [4.1 Regression] Ada bootstrap ICE in
 build_int_cst_wide, at tree.c:795

ebotcazou at gcc dot gnu dot org wrote:

> In build_int_cst_wide, we're asserting that the type of shared constants
> attached to a type is precisely that type:
> 
>       t = TREE_VEC_ELT (TYPE_CACHED_VALUES (type), ix);
>       if (t)
>       {
>         /* Make sure no one is clobbering the shared constant.  */
>         gcc_assert (TREE_TYPE (t) == type);
> 
> But in set_sizetype we're boldly copying TYPE_CACHED_VALUES between types:
> 
>   /* We do want to use bitsizetype's cache, as we will be replacing that
>      type.  */
>   TYPE_CACHED_VALUES (t) = TYPE_CACHED_VALUES (bitsizetype);
>   TYPE_CACHED_VALUES_P (t) = TYPE_CACHED_VALUES_P (bitsizetype);
> 
> 
> Nathan, who is right here?

Both are correct.  However it looks like some integer constant created before 
set_sizetype is called has not got its type updated correctly.

The problem here is that we have to create some types before setting size_type, 
and in creating those types we need to set their size to some integral 
constant, 
and that integral constant has to have a type.  That uses the stub sizetype 
type, which we overwrite further down set_sizetype.

   /* Replace our original stub sizetype.  */
   memcpy (sizetype, t, tree_size (sizetype));
   TYPE_MAIN_VARIANT (sizetype) = sizetype;

My guess is that we've already created some type variants of the stub type at 
that point, which is not what I expected.  There should really be an
        gcc_assert (!TYPE_NEXT_VARIANT (sizetype) && !TYPE_NEXT_VARIANT (t));
just before the memcpy

nathan



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24053

Reply via email to