The following code aborts if built for i686-pc-linux-gnu with -msse2 -O3. extern void abort (void); int main (void) { int i; long x[12] __attribute__((aligned(16))); x[0] = 1; for (i = 0; i < 12; i++) x[i] = i; if (x[0] != 0) abort (); return 0; }
The loop gets vectorized using "vector int *" pointers, and then the compiler decides that "vector int" writes don't conflict with "long" reads. (If an array of int is used instead, the test passes.) (Not x86-specific; originally observed as a failure of gcc.c-torture/execute/loop-13.c on SPE with an unsubmitted patch to support autovectorization there.) -- Summary: [4.3/4.4 Regression] vectorizer aliasing bug Product: gcc Version: 4.4.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jsm28 at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36493