https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119155
Bug ID: 119155 Summary: Aligned vector element accesses emitted for packed struct access Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- struct s { int x; } __attribute__((packed)); void f (char *xc, char *yc, int z) { for (int i = 0; i < 100; ++i) { struct s *x = (struct s *) xc; struct s *y = (struct s *) yc; x->x += y->x; xc += z; yc += z; } } shows we emit _52 = __MEM <int> ((int *)_50); _53 = _50 + _4; _54 = __MEM <int> ((int *)_53); _55 = _53 + _4; _56 = __MEM <int> ((int *)_55); _57 = _55 + _4; _58 = __MEM <int> ((int *)_57); _59 = _Literal (int [[gnu::vector_size(16)]]) {_52, _54, _56, _58}; instead of byte-aligned int loads with -O3 -fno-vect-cost-model when doing VMAT_STRIDED_SLP or VMAT_ELEMENTWISE, likely because we represent alignment info and not check the DRs base alignment when interpreting "unknown misalignment".