https://gcc.gnu.org/g:61b45d514d49f1e075b2cab97ffd6038c41d0c3d
commit 61b45d514d49f1e075b2cab97ffd6038c41d0c3d Author: Mikael Morin <mik...@gcc.gnu.org> Date: Wed Feb 12 18:30:17 2025 +0100 Suppression code redondant initialisation descriptor temporaire Diff: --- gcc/fortran/trans-array.cc | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index fd6f9f56dcb1..6765034f9bd6 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -3839,7 +3839,6 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, || (fcn_ss && fcn_ss->info && fcn_ss->info->class_container)) { tree class_data; - tree dtype; gfc_expr *expr1 = fcn_ss ? fcn_ss->info->expr : NULL; /* Pick out these transformational functions because they change the rank @@ -3894,15 +3893,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, class_data = gfc_class_data_get (tmp); if (rank_changer) - { - /* Take the dtype from the class expression. */ - dtype = gfc_conv_descriptor_dtype_get (gfc_class_data_get (class_expr)); - gfc_conv_descriptor_dtype_set (pre, desc, dtype); - - /* These transformational functions change the rank. */ - gfc_conv_descriptor_rank_set (pre, desc, ss->loop->dimen); - fcn_ss->info->class_container = NULL_TREE; - } + fcn_ss->info->class_container = NULL_TREE; /* Assign the new descriptor to the _data field. This allows the vptr _copy to be used for scalarized assignment since the class @@ -3914,12 +3905,6 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, /* Point desc to the class _data field. */ desc = class_data; } - else - { - /* Fill in the array dtype. */ - gfc_conv_descriptor_dtype_set (pre, desc, - gfc_get_dtype (TREE_TYPE (desc))); - } info->descriptor = desc; size = gfc_index_one_node; @@ -4007,10 +3992,6 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, size = NULL_TREE; } - /* Set the span. */ - tmp = fold_convert (gfc_array_index_type, elemsize); - gfc_conv_descriptor_span_set (pre, desc, tmp); - tree data_ptr = gfc_trans_allocate_array_storage (pre, post, info, size, nelem, initial, dynamic, dealloc);