When building the following test case: unsigned int output[4]; void test (unsigned short *p) { unsigned int x = *p; if (x) { output[0] = x << 1; output[1] = x << 1; output[2] = x << 1; output[3] = x << 1; } } GCC crashes with various symptoms (segmentation fault if checking is disabled; assertion failures along the lines of "vector VEC(tree,base) index domain error, in vect_create_vectorized_promotion_stmts at tree-vect-stmts.c:2130" if checking is enabled) when building on ARM with -O1 -ftree-vectorize -mfpu=neon -mfloat-abi=softfp.
It seems the root cause of all the memory problems is that vect_get_smallest_scalar_type neglects to handle WIDEN_LSHIFT_EXPR, which causes the SLP pass to mis-compute the number of statements needed to vectorize the expression.
Created attachment 26968 [details] Handle WIDEN_LSHIFT_EXPR in vect_get_smallest_scalar_type The attached patch fixes the ICEs for me.
Author: uweigand Date: Mon Mar 26 13:13:07 2012 New Revision: 185795 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=185795 Log: gcc/ PR tree-optimization/52686 * tree-vect-data-refs.c (vect_get_smallest_scalar_type): Handle WIDEN_LSHIFT_EXPR. gcc/testsuite/ PR tree-optimization/52686 * gcc.target/arm/pr52686.c: New test. Added: trunk/gcc/testsuite/gcc.target/arm/pr52686.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-data-refs.c
Fixed.