diff -Naur sources/gcc/tree-vect-slp.c sources.patch/gcc/tree-vect-slp.c --- sources/gcc/tree-vect-slp.c 2012-03-12 12:31:42.000000000 +0100 +++ sources.patch/gcc/tree-vect-slp.c 2012-03-20 13:36:46.000000000 +0100 @@ -2450,7 +2450,7 @@ } /* Allocate memory for vectorized defs. */ - vec_defs = VEC_alloc (tree, heap, number_of_vects); + vec_defs = VEC_alloc (tree, heap, number_of_vects + 1); /* For reduction defs we call vect_get_constant_vectors (), since we are looking for initial loop invariant values. */ @@ -2827,7 +2827,7 @@ if (!SLP_TREE_VEC_STMTS (node)) { - SLP_TREE_VEC_STMTS (node) = VEC_alloc (gimple, heap, vec_stmts_size); + SLP_TREE_VEC_STMTS (node) = VEC_alloc (gimple, heap, vec_stmts_size + 1); SLP_TREE_NUMBER_OF_VEC_STMTS (node) = vec_stmts_size; } diff -Naur sources/gcc/tree-vect-stmts.c sources.patch/gcc/tree-vect-stmts.c --- sources/gcc/tree-vect-stmts.c 2012-03-12 12:31:42.000000000 +0100 +++ sources.patch/gcc/tree-vect-stmts.c 2012-03-20 15:14:28.000000000 +0100 @@ -2954,7 +2954,7 @@ FOR_EACH_VEC_ELT (tree, vec_oprnds0, i, vop0) { vop1 = ((op_type == binary_op || op_type == ternary_op) - ? VEC_index (tree, vec_oprnds1, i) : NULL_TREE); + ? ((i < VEC_length(tree, vec_oprnds1))?VEC_index (tree, vec_oprnds1, i) : VEC_index (tree, vec_oprnds1, VEC_length(tree, vec_oprnds1) - 1)) : NULL_TREE); vop2 = ((op_type == ternary_op) ? VEC_index (tree, vec_oprnds2, i) : NULL_TREE); new_stmt = gimple_build_assign_with_ops3 (code, vec_dest,