From: Mikael Morin <[email protected]>

Fortran-tested on aarch64-unknown-linux-gnu.  OK for mainline?

-- >8 --

The function gfc_set_descriptor_from_scalar unwraps any array type from the
element type it passes as argument to the function gfc_get_dtype_rank_type.
The latter function unwraps array types similarly from its input, making the
previous unwrapping redundant.  This change removes it.

        PR fortran/122521

gcc/fortran/ChangeLog:

        * trans-descriptor.cc (gfc_set_descriptor_from_scalar): Pass element
        type to gfc_get_dtype_rank_type without redundantly unwrapping any
        array type from it.
---
 gcc/fortran/trans-descriptor.cc | 2 --
 1 file changed, 2 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 23321b5b48c..6ea4a1565c6 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -901,8 +901,6 @@ gfc_set_descriptor_from_scalar (stmtblock_t *block, tree 
descr, tree scalar)
   tree etype = TREE_TYPE (scalar);
   if (!POINTER_TYPE_P (TREE_TYPE (scalar)))
     scalar = gfc_build_addr_expr (NULL_TREE, scalar);
-  else if (TREE_TYPE (etype) && TREE_CODE (TREE_TYPE (etype)) == ARRAY_TYPE)
-    etype = TREE_TYPE (etype);
 
   gfc_conv_descriptor_dtype_set (block, descr,
                                 gfc_get_dtype_rank_type (0, etype));
-- 
2.53.0

Reply via email to