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] Fix PR middle-end/17793


On Fri, 22 Oct 2004 09:08:57 +0200, Eric Botcazou <ebotcazou@libertysurf.fr> wrote:

> Maybe a bug (related to PR middle-end/17746), but not the bug we're discussing 
> here: handled_component_p is not invoked between the gimplification of 
> ADDR_EXPR <VIEW_CONVERT_EXPR> and the subsequent call to gimplify_addr_expr.

No, I didn't mean that it would be.  We call gimplify_addr_expr on the
ADDR_EXPR <NOP_EXPR>, which then calls gimplify_expr on the NOP_EXPR to
make sure it's addressable.

> The problem is that the NOP_EXPR is stripped beforehand in the main loop of 
> the gimplifier because of
>
>       /* Strip away as many useless type conversions as possible
> 	 at the toplevel.  */
>       STRIP_USELESS_TYPE_CONVERSION (*expr_p);

Ah, I suppose we hit that in the call to gimplify_expr for the NOP_EXPR, so
we don't end up allocating a temporary.

> Jeff proposed to bypass this particular kind of NOP_EXPRs (I've now realized 
> my original patch was not specific enough) in gimplify_addr_expr.  This could 
> be written as:

> +      /* If the operand is a useless conversion, look through it.  Doing so
> +        guarantees that the ADDR_EXPR and its operand will remain of the
> +        same type.  */
> +      if (tree_ssa_useless_type_conversion (TREE_OPERAND (op0, 0)))
> +          op0 = TREE_OPERAND (op0, 0);
> +
>        *expr_p = fold_convert (TREE_TYPE (expr),
>                               build_fold_addr_expr (TREE_OPERAND (op0, 0)));
>        ret = GS_OK;
>
> Do you agree with this approach?  I think it won't preclude us from making a 
> temporary for non-useless NOP_EXPRs if we deem it necessary.

Yes, I think that makes sense.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]