This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix PR middle-end/17885, gimplifing of volatile &a->b
- From: Jason Merrill <jason at redhat dot com>
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Cc: pinskia at physics dot uc dot edu, gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Oct 2004 15:45:48 -0400
- Subject: Re: [PATCH] fix PR middle-end/17885, gimplifing of volatile &a->b
- References: <10410181940.AA07336@vlsi1.ultra.nyu.edu>
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