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/17885, gimplifing of volatile &a->b


On Mon, 18 Oct 04 15:40:57 EDT, kenner@vlsi1.ultra.nyu.edu (Richard Kenner) wrote:

>     Because the COMPONENT_REF has its TREE_SIDE_EFFECTS set then by
>     recompute_tree_invarant_for_addr_expr so does the ADDR_EXPR, this
>     might be a bug in that function though.
>
> I think it is.  But the TREE_SIDE_EFFECTS bit in the COMPONENT_REF is
> ignored; the issue is that the operand of the COMPONENT_REF also must have
> TREE_SIDE_EFFECTS set.  But I agree that shouldn't set TREE_SIDE_EFFECTS of
> an ADDR_EXPR: only if the computation of the *address* has side-effects should
> TREE_SIDE_EFFECTS be set.
>
> Specifically, I think the line
>
>       se |= TREE_SIDE_EFFECTS (node);
>
> should be deleted.

I think that should still be the general case; if we're taking the address
of, say, a struct returned from a function, we want to propagate
TREE_SIDE_EFFECTS from the call to the ADDR_EXPR.

But we should special-case COMPONENT_REF so that TREE_SIDE_EFFECTS is
propagated from op0 to the ADDR_EXPR, not from the ref itself.  With
appropriate recursion.

Jason


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