Index: testsuite/gcc.dg/matrix/matrix-6.c =================================================================== *** testsuite/gcc.dg/matrix/matrix-6.c (revision 125215) --- testsuite/gcc.dg/matrix/matrix-6.c (working copy) *************** mem_init (void) *** 89,95 **** } } } ! *vel[1] = (int *)d; } /*--------------------------------------------------------------------------*/ --- 89,95 ---- } } } ! *vel[1] = &d; } /*--------------------------------------------------------------------------*/ Index: matrix-reorg.c =================================================================== *** matrix-reorg.c (revision 125223) --- matrix-reorg.c (working copy) *************** transform_access_sites (void **slot, voi *** 1800,1812 **** { if (x - y == 0) new_offset = offset; ! else { tree log = build_int_cst (type, x - y); new_offset = fold_build2 (LSHIFT_EXPR, TREE_TYPE (offset), offset, log); } } else { --- 1800,1820 ---- { if (x - y == 0) new_offset = offset; ! else if (x - y > 0) { tree log = build_int_cst (type, x - y); new_offset = fold_build2 (LSHIFT_EXPR, TREE_TYPE (offset), offset, log); } + else + { + tree log = build_int_cst (type, y - x); + + new_offset = + fold_build2 (RSHIFT_EXPR, TREE_TYPE (offset), + offset, log); + } } else { *************** transform_allocation_sites (void **slot, *** 2081,2089 **** } else { ! dim_size = ! fold_build2 (TRUNC_DIV_EXPR, type, mi->dimension_size_orig[id], ! d_type_size); dim_size = fold_build2 (MULT_EXPR, type, dim_size, prev_dim_size); } --- 2089,2125 ---- } else { ! int x, y; ! ! x = exact_log2 (mi->dimension_type_size[i + 1]); ! y = exact_log2 (mi->dimension_type_size[mi->dim_map[i] + 1]); ! ! if (x != -1 && y != -1) ! { ! if (x - y == 0) ! dim_size = mi->dimension_size_orig[id]; ! else ! { ! if (x - y > 0) ! { ! tree log = build_int_cst (type, x - y); ! dim_size = ! fold_build2 (LSHIFT_EXPR, ! TREE_TYPE (mi->dimension_size_orig[id]), ! mi->dimension_size_orig[id], log); ! } ! else ! { ! tree log = build_int_cst (type, y - x); ! ! dim_size = ! fold_build2 (RSHIFT_EXPR, ! TREE_TYPE (mi->dimension_size_orig[id]), ! mi->dimension_size_orig[id], log); ! ! } ! } ! } dim_size = fold_build2 (MULT_EXPR, type, dim_size, prev_dim_size); } =