https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102043

--- Comment #24 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 19 Nov 2021, mikael at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102043
> 
> --- Comment #23 from Mikael Morin <mikael at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #21)
> > (In reply to Bernhard Reutner-Fischer from comment #17)
> > > Do we want to address arrays always at position 0 (maybe to help graphite 
> > > ?)
> > 
> > Helping graphite (and other loop optimizers) would be to not lower
> > multi-dimensional accesses to a single dimension (I think that's what
> > Sandras patches try to do). 
> 
> Or maybe graphite can be taught to handle flattened array access?
> 
> Anyway, does the middle-end support out-of-order array access?
> Namely for an array arr(4, 5, 6), arr(:, 1, :) is an array of size (4, 6).
> Does the middle-end type system support this?

Support as in not miscompile - yes.  Dependence analysis is only
helped if the shapes of the accesses to the same storage are
compatible - a two dimensional and a three dimensional access are not.

> In any case, it’s not for gcc 12.

Agreed.

> > The lower bound doesn't really matter here and
> > is well-handled by all code.
> 
> Well, unless the lower bound is negative. ;-)

Even a negative lower bound is OK.  Problematic is only if you
provide an index that accesses the array below the (negative)
lower bound ;)  But note!  In GCC  a[i] with a having a lower
bound of say -100 will access storage at &a + (i - -100),
the lower bound is just to make the effective index >= 0 again,
so it can't be used (on its own) to solve the present issue
as far as I understand since you _do_ need to access the
storage at an effective index < 0.

Reply via email to