http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60656
Bug ID: 60656 Summary: [4.8/4.9 regression] x86 vectorization produces wrong code Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: ppluzhnikov at google dot com Current trunk (r208813) and gcc-4.8 are affected, 4.7 does not appear to be. gcc -O0 t.c && ./a.out 500450210036 gcc -O3 t.c && ./a.out 500450200033 gcc -O2 t.c && ./a.out 500450210036 gcc -O2 t.c -ftree-vectorize && ./a.out 500450200033 // t.c #include <stdio.h> int main () { int v[] = {5000, 5001, 5002, 5003}; long s = 0; int i; for(i = 0; i < 4; ++i) { long P = v[i]; s += P*P*P; } printf("%ld\n", s); }