[gcc(refs/users/mikael/heads/refactor_descriptor_v206.01)] fortran: array descriptor: Factor scalar descriptor init 2/2 [PR122521]

Mikael Morin via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:9223199bf66e29bbfc47a013a1e7b3c86ded58ec

commit 9223199bf66e29bbfc47a013a1e7b3c86ded58ec
Author: Mikael Morin <[email protected]>
Date:   Tue Aug 18 14:37:48 2026 +0200

    fortran: array descriptor: Factor scalar descriptor init 2/2 [PR122521]
    
    Fortran-tested on aarch64-unknown-linux-gnu.  OK for mainline?
    
    -- >8 --
    
    The previous changes brought to gfc_set_descriptor_from_scalar removed the
    main differences preventing them to be merged together.  Now we are left
    with two overloads having similar code, the second one being a simplified
    version of the first.  Forward the former to the latter.
    
            PR fortran/122521
    
    gcc/fortran/ChangeLog:
    
            * trans-descriptor.cc (gfc_set_descriptor_from_scalar): Forward
            to the other overload instead of using a simplified inline copy of
            its code.
    
    Correction compil'
    
    Correction
    
    Revert "fortran: array descriptor: Factor scalar descriptor init 2/2 [PR122521]"
    
    This reverts commit 23c8401419428ddf281d69cff3207bc09bf94bd4.
    
    Correction variable inutilisée

Diff:
---
 gcc/fortran/trans-descriptor.cc | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index e11bac4a9f65..02a4187f2305 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -890,13 +890,9 @@ gfc_set_descriptor_from_scalar (stmtblock_t *block, tree descr,
 void
 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);
-
-  gfc_conv_descriptor_dtype_set (block, descr,
-				 gfc_get_dtype_rank_type (0, etype));
-  gfc_conv_descriptor_data_set (block, descr, scalar);
+  gfc_set_descriptor_from_scalar (block, descr, scalar, NULL_TREE);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.