[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:b677d1171f2955ea572e7eb066b143c990c948ad

commit b677d1171f2955ea572e7eb066b143c990c948ad
Author: Mikael Morin <[email protected]>
Date:   Tue Aug 11 18:34:56 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.

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

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 8273be6300de..8c959ed0852b 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -871,13 +871,7 @@ gfc_set_descriptor_from_scalar (stmtblock_t *block, tree descr, tree scalar,
 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, 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.