[PATCH] Fix SRA crash on array slice

Eric Botcazou ebotcazou@adacore.com
Tue Sep 18 16:54:00 GMT 2007


> But still the groups field is only set when we find a RANGE_EXPR (see
> IS_ELEMENT_FOR_GROUP).

I know, I wrote this stuff. :-)  RANGE_EXPR is present only for slices.

> 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.

I'm under the impression that you're thinking that decide_block_copy will 
decide to do block copy, but that's not true: it will decide *whether* or
not to do block copy.  The

  /* Don't decide if we've no uses.  */
  if (elt->n_uses == 0 && elt->n_copies == 0)
    ;

is a short-circuit to avoid making the decision when there is no need to.

What the patch does is restricting the conditions under which there is no need 
to make the decision: not only must the array be never referenced or copied 
as before, but there must be no slices of this array.  The rationale is that,
by design, the decision for a slice is to be taken at its parent's level.
This means that the patch is a no-op for arrays that don't have slices.

-- 
Eric Botcazou



More information about the Gcc-patches mailing list