http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60505
Bug ID: 60505 Summary: Warning caused by GCC vectorizer. Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: congh at google dot com The compilation on the code below fails with options "-Wall -Werror -O2 -ftree-loop-vectorize". The reason is that the epilogue generated by the vectorizer tries to access the memory outside of ovec[16] and the the vrp pass emits the warning "array subscript is above array bounds" for the access to ovec[i]. The vectorizer should not generate the epilogue for this loop. void foo(char *in, char *out, int num) { int i; unsigned char ovec[16] = {0}; for(i=0; i < num ; ++i) out[i] = (ovec[i] = in[i]); out[num] = ovec[num/2]; }