https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121224
Bug ID: 121224 Summary: auto-vectorizer generates aligned accesses to potentially unaligned memory Product: gcc Version: 15.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: olaf.krzikalla at dlr dot de Target Milestone: --- ``` typedef __attribute__(( aligned(32))) double aligned_double; void add(aligned_double* a, aligned_double* b, aligned_double* c, int end, int start) { for (decltype(end) i = start; i < end; ++i) c[i] = a[i] + b[i]; } ``` Compile with `gcc 15.1 -O3 -march=core-avx2`. The auto vectorizer generates aligned loads (`movapd`). This causes seg faults, if `start` is not properly aligned (e.g. `start == 1`). Runable test (on gcc trunk): https://godbolt.org/z/r71EafjK8