This fixes PR49603. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard. 2011-07-01 Richard Guenther <rguent...@suse.de> PR tree-optimization/49603 * tree-vect-stmts.c (vectorizable_load): Remove unnecessary assert. * gcc.dg/torture/pr49603.c: New testcase. Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (revision 175709) +++ gcc/tree-vect-stmts.c (working copy) @@ -4574,19 +4574,14 @@ vectorizable_load (gimple stmt, gimple_s /* 4. Handle invariant-load. */ if (inv_p && !bb_vinfo) { + tree vec_inv; + gimple_stmt_iterator gsi2 = *gsi; gcc_assert (!strided_load); - if (j == 0) - { - tree vec_inv; - gimple_stmt_iterator gsi2 = *gsi; - gsi_next (&gsi2); - vec_inv = build_vector_from_val (vectype, scalar_dest); - new_temp = vect_init_vector (stmt, vec_inv, - vectype, &gsi2); - new_stmt = SSA_NAME_DEF_STMT (new_temp); - } - else - gcc_unreachable (); /* FORNOW. */ + gsi_next (&gsi2); + vec_inv = build_vector_from_val (vectype, scalar_dest); + new_temp = vect_init_vector (stmt, vec_inv, + vectype, &gsi2); + new_stmt = SSA_NAME_DEF_STMT (new_temp); } if (negative) Index: gcc/testsuite/gcc.dg/torture/pr49603.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr49603.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr49603.c (revision 0) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +struct gl_visual { + float AlphaScale; +}; +struct gl_context { + struct gl_visual *Visual; +}; +void quickdraw_rgb( struct gl_context * ctx, + int width, int height) +{ + int i, j; + unsigned char alpha[1600]; + for (j=0; j<width; j++) + alpha[j] = (int) ctx->Visual->AlphaScale; + for (i=0; i<height; i++) + foo( alpha); +} +