https://gcc.gnu.org/g:0db8eab9916e8c4c3f3765ddf4b442ced22ae25d

commit 0db8eab9916e8c4c3f3765ddf4b442ced22ae25d
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Sat Aug 16 19:16:15 2025 +0200

    Refactor set_dimension_fields descriptor_init_count

Diff:
---
 gcc/fortran/trans-descriptor.cc | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 4ab5c75a3832..5f706c4f6a2a 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -2788,16 +2788,8 @@ gfc_descriptor_init_count (tree descriptor, int rank, 
int corank,
              ubound = lower[n];
            }
        }
-      gfc_conv_descriptor_lbound_set (descriptor_block, descriptor,
-                                     gfc_rank_cst[n], se.expr);
       conv_lbound = se.expr;
 
-      /* Work out the offset for this component.  */
-      tmp = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type,
-                            se.expr, stride);
-      offset = fold_build2_loc (input_location, MINUS_EXPR,
-                               gfc_array_index_type, offset, tmp);
-
       /* Set upper bound.  */
       gfc_init_se (&se, NULL);
       if (expr3_desc != NULL_TREE)
@@ -2832,13 +2824,10 @@ gfc_descriptor_init_count (tree descriptor, int rank, 
int corank,
          if (ubound->expr_type == EXPR_FUNCTION)
            se.expr = gfc_evaluate_now (se.expr, pblock);
        }
-      gfc_conv_descriptor_ubound_set (descriptor_block, descriptor,
-                                     gfc_rank_cst[n], se.expr);
       conv_ubound = se.expr;
 
-      /* Store the stride.  */
-      gfc_conv_descriptor_stride_set (descriptor_block, descriptor,
-                                     gfc_rank_cst[n], stride);
+      set_dimension_fields (descriptor_block, descriptor, gfc_rank_cst[n],
+                           conv_lbound, conv_ubound, stride, &offset);
 
       /* Calculate size and check whether extent is negative.  */
       size = gfc_conv_array_extent_dim (conv_lbound, conv_ubound, &empty_cond);

Reply via email to