https://gcc.gnu.org/g:04aaffc0dae9a9ef204dd87962e51f92ca8dcb1d

commit 04aaffc0dae9a9ef204dd87962e51f92ca8dcb1d
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Mon Mar 17 19:26:09 2025 +0100

    fortran: Remove premature initialization of a function result's span
    
    Setting just the span in an otherwise uninitialized array descriptor to
    pass to a function that will use the descriptor for its result (thus do
    the initialization) doesn't seem to be useful.
    
    gcc/fortran/ChangeLog:
    
            * trans-array.cc (gfc_conv_expr_descriptor): Remove
            isolated initialization of the span field before passing to
            the function that will do the initialization.

Diff:
---
 gcc/fortran/trans-array.cc | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 990aaaffb50e..98f6ea160160 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8509,14 +8509,6 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
          else
            gcc_assert (se->ss == ss);
 
-         if (!is_pointer_array (se->expr))
-           {
-             tmp = gfc_get_element_type (TREE_TYPE (se->expr));
-             tmp = fold_convert (gfc_array_index_type,
-                                 size_in_bytes (tmp));
-             gfc_conv_descriptor_span_set (&se->pre, se->expr, tmp);
-           }
-
          se->expr = gfc_build_addr_expr (NULL_TREE, se->expr);
          gfc_conv_expr (se, expr);

Reply via email to