This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix SRA crash on array slice
Eric Botcazou <ebotcazou@adacore.com> writes:
> > This doesn't look right to me. elt->groups will only be set for a
> > slice. But decide_block_copy is called for things other than slices.
> > For those things, elt->groups will be NULL.
>
> elt->groups is not set for a slice (when elt is a slice), it is set for the
> parent of a slice (elt is the whole array). It's elt->is_group
>
> /* True if this element is a group of members of its parent. */
> bool is_group;
>
> that is set for a slice.
>
> Moreover, decide_block_copy is never called for slices
>
> /* We shouldn't be invoked on groups of sub-elements as they must
> behave like their parent as far as block copy is concerned. */
> gcc_assert (!elt->is_group);
>
> but only for the parent of a slice. Therefore the decision must be made for
> such a parent, even though it is not mentioned as a whole in the code.
Right, sorry. Thanks for the clarification.
But still the groups field is only set when we find a RANGE_EXPR (see
IS_ELEMENT_FOR_GROUP). And as far as I can see decide_block_copy will
be called for arrays which don't use RANGE_EXPRs, and it will do
something meaningful for them. So I am still missing something about
why your patch is always correct.
Ian