https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114178
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Evan Teran from comment #4) > @Andrew, thanks for the quick analysis! Just to confirm, the warning is in > fact incorrect and the emitted code is not stomping outside of the buffer > bounds? > > I ask because I did also one last bit, which is that changing the buffer > size can make the warning go away. That is if I make the buffer in the > example something like 132, then it's happy again, which at the very least, > makes me wonder if the vectorized code is in fact going out of bounds when > the size doesn't align with the vectorized code's expectations. The code is not incorrect, It is the peel part for unaligned part of the stores. Just the warning is not using the same information that the peeling part had available to it and getting confused by it. Basically -ffreestanding is needed to hit the warning because GCC will use memset rather than vectorize the store loop. Adding -fno-tree-loop-distribute-patterns instead of -ffreestanding will also cause the warning for the same reason.