[gcc(refs/users/mikael/heads/refactor_descriptor_v203.05)] Correction allocate_with_mold_6

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

commit 0be4fe0958cc995e44e13b88e2cb8c5dc52a3ee6
Author: Mikael Morin <[email protected]>
Date:   Wed Jul 15 18:25:58 2026 +0200

    Correction allocate_with_mold_6

Diff:
---
 gcc/fortran/trans-array.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 3075cae8b6c4..382f40b7d334 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -10693,8 +10693,11 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, tree dest,
 		{
 		  ftn_tree = builtin_decl_explicit (BUILT_IN_MALLOC);
 		  tmp = build_call_expr_loc (input_location, ftn_tree, 1, size);
-		  gfc_add_modify (&tmpblock, dst_data,
-				  fold_convert (TREE_TYPE (dst_data), tmp));
+		  if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (dst_data)))
+		    gfc_conv_descriptor_data_set (&tmpblock, dst_data, tmp);
+		  else
+		    gfc_add_modify (&tmpblock, dst_data,
+				    fold_convert (TREE_TYPE (dst_data), tmp));
 		}
 
 	      tmp = gfc_copy_class_to_class (comp, dcmp, nelems,
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.