From patchwork Sat Sep 4 14:22:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [fortran,3/11] Inline transpose part 1 Date: Sat, 04 Sep 2010 04:22:40 -0000 From: Mikael Morin X-Patchwork-Id: 63782 Message-Id: <4C825630.9050804@sfr.fr> To: "fortran@gcc.gnu.org" , gcc-patches Now it starts to be interesting. If we want to have the dim array keep pointing on the transposed array, we better have gfc_trans_create_temp_array not overwriting it. Then if gfc_trans_create_temp_array doesn't set it, it should be done before. OK for trunk? 2010-09-03 Mikael Morin * trans-array.c (gfc_trans_create_temp_array): Don't set dim array. (gfc_conv_loop_setup): Set dim array. (gfc_walk_function_expr): Ditto. * trans-intrinsic.c (gfc_walk_intrinsic_libfunc): Ditto. diff --git a/trans-array.c b/trans-array.c index 5902aff..5086641 100644 --- a/trans-array.c +++ b/trans-array.c @@ -753,7 +753,6 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, info->start[dim] = gfc_index_zero_node; info->end[dim] = gfc_index_zero_node; info->stride[dim] = gfc_index_one_node; - info->dim[dim] = dim; } /* Initialize the descriptor. */ @@ -3768,6 +3767,11 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where) memset (&loop->temp_ss->data.info, 0, sizeof (gfc_ss_info)); loop->temp_ss->type = GFC_SS_SECTION; loop->temp_ss->data.info.dimen = n; + + gcc_assert (loop->temp_ss->data.info.dimen != 0); + for (n = 0; n < loop->temp_ss->data.info.dimen; n++) + loop->temp_ss->data.info.dim[n] = n; + gfc_trans_create_temp_array (&loop->pre, &loop->post, loop, &loop->temp_ss->data.info, tmp, NULL_TREE, false, true, false, where); @@ -6740,6 +6744,7 @@ gfc_walk_function_expr (gfc_ss * ss, gfc_expr * expr) gfc_intrinsic_sym *isym; gfc_symbol *sym; gfc_component *comp = NULL; + int n; isym = expr->value.function.isym; @@ -6761,6 +6766,8 @@ gfc_walk_function_expr (gfc_ss * ss, gfc_expr * expr) newss->expr = expr; newss->next = ss; newss->data.info.dimen = expr->rank; + for (n = 0; n < newss->data.info.dimen; n++) + newss->data.info.dim[n] = n; return newss; } diff --git a/trans-intrinsic.c b/trans-intrinsic.c index 8f50e6d..c0998ba 100644 --- a/trans-intrinsic.c +++ b/trans-intrinsic.c @@ -5789,6 +5789,7 @@ static gfc_ss * gfc_walk_intrinsic_libfunc (gfc_ss * ss, gfc_expr * expr) { gfc_ss *newss; + int n; gcc_assert (expr->rank > 0); @@ -5797,6 +5798,8 @@ gfc_walk_intrinsic_libfunc (gfc_ss * ss, gfc_expr * expr) newss->expr = expr; newss->next = ss; newss->data.info.dimen = expr->rank; + for (n = 0; n < newss->data.info.dimen; n++) + newss->data.info.dim[n] = n; return newss; }