This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR14841 and PR15838
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: stevenb at suse dot de
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 31 Aug 04 12:43:03 EDT
- Subject: Re: [PATCH] PR14841 and PR15838
Not really. This optimization is not done by fold-const.c.
Why else do you think it didn't work before? ;-)
I don't know, but it's there for the component case, or at least code
that purports to be that:
case COMPONENT_REF:
if (TREE_CODE (arg0) == CONSTRUCTOR
&& ! type_contains_placeholder_p (TREE_TYPE (arg0)))
{
tree m = purpose_member (arg1, CONSTRUCTOR_ELTS (arg0));
if (m)
return TREE_VALUE (m);
}
return t;
We cannot do this in fold-const.c, because there we can't tell if we
had just "a = b[c];" or perhaps "a = &b[c];". That's why I've put it
in tree-ssa-ccp.c.
If this is just the case where B is a CONSTRUCTOR, I don't understand
the issue you are raising.