This fixes PR54920. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied on trunk and the 4.7 branch.
Richard. 2012-10-15 Richard Guenther <rguent...@suse.de> PR tree-optimization/54920 * tree-ssa-pre.c (create_expression_by_pieces): Properly allocate temporary storage for all NARY elements. * gcc.dg/torture/pr54920.c: New testcase. Index: gcc/tree-ssa-pre.c =================================================================== --- gcc/tree-ssa-pre.c (revision 192398) +++ gcc/tree-ssa-pre.c (working copy) @@ -2853,7 +2853,7 @@ create_expression_by_pieces (basic_block case NARY: { vn_nary_op_t nary = PRE_EXPR_NARY (expr); - tree genop[4]; + tree *genop = XALLOCAVEC (tree, nary->length); unsigned i; for (i = 0; i < nary->length; ++i) { Index: gcc/testsuite/gcc.dg/torture/pr54920.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr54920.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr54920.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +typedef short __v8hi __attribute__ ((__vector_size__ (16))); +typedef long long __m128i __attribute__ ((__vector_size__ (16))); +int a; +__m128i b; + +void +fn1 () +{ + while (1) + b = (__m128i) (__v8hi) { a, 0, 0, 0, 0, 0 }; +}