Index: ChangeLog =================================================================== --- ChangeLog (revision 129623) +++ ChangeLog (working copy) @@ -1,5 +1,11 @@ 2007-10-25 Ira Rosen + PR tree-optimization/33833 + * tree-vect-analyze.c (vect_analyze_data_refs): Use POINTER_PLUS_EXPR + and convert init to sizetype in inner_base construction. + +2007-10-25 Ira Rosen + PR tree-optimization/33866 * tree-vect-transform.c (vectorizable_store): Check operands of all the stmts in the group of strided accesses. Get def stmt type for each store Index: testsuite/gcc.dg/vect/pr33833.c =================================================================== --- testsuite/gcc.dg/vect/pr33833.c (revision 0) +++ testsuite/gcc.dg/vect/pr33833.c (revision 0) @@ -0,0 +1,31 @@ +/* Testcase by Martin Michlmayr */ +/* { dg-do compile } */ + +struct list_head +{ + struct list_head *prev; +}; +struct prio_array +{ + struct list_head queue[100]; +}; +struct rq +{ + struct prio_array *active, arrays[2]; +} per_cpu__runqueues; + +void sched_init (unsigned long __ptr) +{ + int j, k; + struct prio_array *array; + struct rq *rq; + rq = (&(*( { (typeof (&per_cpu__runqueues)) (__ptr); } ))); + for (j = 0; j < 2; j++) + { + array = rq->arrays + j; + for (k = 0; k < 100; k++) + (array->queue + k)->prev = array->queue; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 129623) +++ testsuite/ChangeLog (working copy) @@ -1,6 +1,12 @@ 2007-10-25 Martin Michlmayr Ira Rosen + PR tree-optimization/33833 + * gcc.dg/vect/pr33833.c: New testcase. + +2007-10-25 Martin Michlmayr + Ira Rosen + PR tree-optimization/33866 * gcc.dg/vect/pr33866.c: New testcase. Index: tree-vect-analyze.c =================================================================== --- tree-vect-analyze.c (revision 129622) +++ tree-vect-analyze.c (working copy) @@ -3287,10 +3287,11 @@ vect_analyze_data_refs (loop_vec_info lo /* Build a reference to the first location accessed by the inner-loop: *(BASE+INIT). (The first location is actually - BASE+INIT+OFFSET, but we add OFFSET separately later. */ - tree inner_base = build_fold_indirect_ref - (fold_build2 (PLUS_EXPR, - TREE_TYPE (base), base, init)); + BASE+INIT+OFFSET, but we add OFFSET separately later). */ + tree inner_base = build_fold_indirect_ref + (fold_build2 (POINTER_PLUS_EXPR, + TREE_TYPE (base), base, + fold_convert (sizetype, init))); if (vect_print_dump_info (REPORT_DETAILS)) {