https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98214
Bug ID: 98214 Summary: SVE: Wrong code with -O3 -msve-vector-bits=512 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- AArch64 GCC miscompiles the following testcase: long c; int a; int e[14]; short b[14]; void d(long *f, long h) { *f ^= h + *f; } int main() { e[2] = 1; for (int g = 0; g < 13; g++) a = b[g] = e[g]; d(&c, a); for (int g = 0; g < 4; g++) d(&c, b[2]); if (c != 15) __builtin_abort(); } at -O3 -march=armv8.2-a+sve -msve-vector-bits=512. Looking at the generated code, it looks like we unconditionally call abort: main: adrp x0, .LANCHOR0 add x0, x0, :lo12:.LANCHOR0 stp x29, x30, [sp, -16]! mov w2, 1 add x1, x0, 56 ptrue p0.b, vl64 mov x29, sp ldr q0, [x0, 32] str w2, [x0, 8] ldrsh w2, [x0, 48] strh w2, [x0, 80] ld1w z1.d, p0/z, [x0] xtn v0.4h, v0.4s st1h z1.d, p0, [x1] str w2, [x0, 84] str xzr, [x0, 88] str d0, [x0, 72] bl abort Possibly related to PR98196.