PATCH: PR middle-end/39345: [4.4 Regression] ICE in copy_tree_body_r, at tree-inline.c:1020

Richard Guenther richard.guenther@gmail.com
Tue Mar 3 15:29:00 GMT 2009


On Tue, Mar 3, 2009 at 4:24 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> can_be_nonlocal calls remap_type which will remap type. But the newly
> remapped type isn't stored anywhere.  This patch adds remapped_type and
> uses it in can_be_nonlocal instead.  OK for trunk?

Ok for trunk if the patch passes bootstrap & regtest and if you
add a comment to remapped_type documenting its arguments
and behavior.

Thanks,
Richard.

> Thanks.
>
>
> H.J.
> ---
> 2009-03-03  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR middle-end/39345
>        * tree-inline.c (remapped_type): New.
>        (can_be_nonlocal): Call remapped_type instead of remap_type.
>
> Index: gcc/tree-inline.c
> ===================================================================
> --- gcc/tree-inline.c   (revision 144529)
> +++ gcc/tree-inline.c   (working copy)
> @@ -426,6 +426,23 @@ remap_type (tree type, copy_body_data *i
>   return tmp;
>  }
>
> +static tree
> +remapped_type (tree type, copy_body_data *id)
> +{
> +  tree *node;
> +
> +  if (type == NULL)
> +    return type;
> +
> +  /* See if we have remapped this type.  */
> +  node = (tree *) pointer_map_contains (id->decl_map, type);
> +  if (node)
> +    return *node;
> +  else
> +    return NULL;
> +}
> +
> +  /* The type only needs remapping if it's variably modified.  */
>  /* Decide if DECL can be put into BLOCK_NONLOCAL_VARs.  */
>
>  static bool
> @@ -446,8 +463,10 @@ can_be_nonlocal (tree decl, copy_body_da
>   if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != PARM_DECL)
>     return false;
>
> -  /* We must use global type.  */
> -  if (TREE_TYPE (decl) != remap_type (TREE_TYPE (decl), id))
> +  /* We must use global type.  We call remapped_type instead of
> +     remap_type since we don't want to remap this type here if it
> +     hasn't been remapped before.  */
> +  if (TREE_TYPE (decl) != remapped_type (TREE_TYPE (decl), id))
>     return false;
>
>   /* Wihtout SSA we can't tell if variable is used.  */
>



More information about the Gcc-patches mailing list