https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113026
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 Keywords| |missed-optimization Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2023-12-15 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- We are diagnosing the scalar store in the epilogue of the vectorized "loop" where we somehow optimized the vector loop to terminate immediately (based on dst[] size I guess) and also peeled the epilogue but failed to eliminate that completely (but then -Wstringop-overflow correctly figures the access would be out-of-bounds). A bit reduced (interestingly when avoiding versioning for aliasing we manage to avoid the diagnostic because of the way we re-use the epilog when n < 16 char dst[16]; void foo (char *src, long n) { for (long i = 0; i < n; i++) dst[i] = src[i]; } in the end this is a missed optimization. We do know an upper bound for the loop so we should have disabled epilog peeling based on that. The peeling code assumes the vector loop can be skipped (niter < vf) only when we either vectorize the epilogue or do not version the loop while the code computing wheter we need peeling takes into account the versioning cost model threshold only.