http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46038
Summary: Vectorizer generates misaligned address for vld1 qn, [rn:alignment] Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: bela...@gcc.gnu.org CC: ju...@gcc.gnu.org This test case: extern void abort (void); void foo (short *__restrict in, int n, int l, short *__restrict o) __attribute__((noinline)); void foo (short *__restrict in, int n, int l , short *__restrict o) { int A=0, lg, i; for (lg = 0; lg < n; lg++) { A = 0; for (i = 0; i < l; i++) A += (int)in[i] + (int)in[i+lg]; } if (A != 256) abort (); } int main() { short in[32]; short o[4]; int i; for (i=0;i<32;i++) in[i] = i; foo (in, 2, 16, o); return 0; } aborts. It's compiled with -c -static -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp foo.c -marm -O3. The first iteration's result 'A' is correct. The second iteration's result is broken. The bug seems to be during the second iteration of the outer loop in foo(), the vld1.16 at 0x8514 seems to be getting a bogus base address that isn't 8-byte aligned inspite of the assertion [rn:64]. This might be a potential source of the bug. The output of dmesg on a cortex-a8 is: Alignment trap: not handling instruction edc30b00 at [<0000c64c>] Unhandled fault: alignment exception (0x801) at 0xbe8818c9