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

--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-03-10 
12:34:57 UTC ---
> It's mixing VLA unaware foldings into the mids of GIMPLE which is the
> root of the issue though.  The issue is latent on trunk.
> 
> Patch for the first (and safe) idea:
> 
> Index: gcc/fold-const.c
> ===================================================================
> --- gcc/fold-const.c    (revision 170818)
> +++ gcc/fold-const.c    (working copy)
> @@ -15554,7 +15560,8 @@ fold_indirect_ref_1 (location_t loc, tre
>         }
>        /* *(foo *)&fooarray => fooarray[0] */
>        else if (TREE_CODE (optype) == ARRAY_TYPE
> -              && type == TREE_TYPE (optype))
> +              && type == TREE_TYPE (optype)
> +              && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
>         {
>           tree type_domain = TYPE_DOMAIN (optype);
>           tree min_val = size_zero_node;
> @@ -15633,7 +15640,8 @@ fold_indirect_ref_1 (location_t loc, tre
> 
>    /* *(foo *)fooarrptr => (*fooarrptr)[0] */
>    if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE
> -      && type == TREE_TYPE (TREE_TYPE (subtype)))
> +      && type == TREE_TYPE (TREE_TYPE (subtype))
> +      && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
>      {
>        tree type_domain;
>        tree min_val = size_zero_node;
> 
> Eric, can you see any issues with that and Ada?

If this is limited to the in_gimple_form case, probably none.

Reply via email to