https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78807
Bug ID: 78807 Summary: Loop optimization trigger bus error Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: m.gcc.gnu.org at alias dot viem.se Target Milestone: --- Created attachment 40331 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40331&action=edit Test program With GCC 5.3.0 on Solaris 11 the below program ends due to bus error on sparc. Turning of tree-loop optimizations with either of the below avoids bus error: -fvect-cost-model=cheap -fno-tree-loop-distribute-patterns -fno-tree-loop-vectorize === bug.c === /* $ gcc -m64 -O3 -fPIC -o bug bug.c $ ./bug Bus Error (core dumped) */ inline void g(unsigned size, unsigned x[], unsigned y[]) { unsigned i; for (i = 0; i < size; i++) { x[i] |= y[i]; } for (i = 0; i < size; i++) { y[i] = 0; } } struct A { long a; // Make struct A 8 byte aligned int b; // Make x[] not 8 byte aligned unsigned x[6]; unsigned y[6]; }; void f(struct A* a) { g(6, a->x, a->y); } int main() { struct A a; f(&a); return 0; } === END of bug.c ===