https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102043
--- Comment #31 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Mikael Morin from comment #28) > I’m reading the previous comments again: > > (In reply to Richard Biener from comment #10) > > So to clarify the ARRAY_REF constraints - there is currently no way to > > construct a valid ARRAY_REF where an index does an access to memory before > > the supplied > > base object. TREE_OPERAND (array_ref, 0) needs to always be the array, > > it's address needs to be the address of the _first_ element. For negative > > strides gfortran seems to construct the array object in a way so its > > address points to the _last_ element of the array. That's not supported. > > > does that means that clearing the lower bound information from the type as I > suggested in my last comment would not work? Correct - the lower bound is used to bias 'i' in 'array[i]', the result still has to be >= 0. As said the middle-end lacks support for (negative) stride arrays. For a negative stride array you'd probably expect array[i] to compute &array[ubound - S * i]? That said, the middle-end doesn't even handle positive strided accesses - the stride needs to be manually reflected to the index which means that the array type domain does not really reflect the "true" shape of the array. It's really tied to C language array support (where array accesses are just fancy ways of pointer arithmetic).