https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102564
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2021-10-04 Version|unknown |12.0 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- The issue is that t can point anywhere into p[], Andrew is correct in that we could in theory do a runtime check but unfortunately vectorization relies on reductions being done on registers and thus store-motion to have taken place. But store-motion does not do any runtime alias checks. The fix is at the source level to add __restrict__ to p for example or to perform the store-motion yourself as you've done in test3. In principle the vectorizer could do reduction vectorization on stride zero memory accesses as well, but currently we give up on such stores completely.