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

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

commit e1fed7c463fc348f2f8e809836315c6ee10bb4a2
Author: Mikael Morin <[email protected]>
Date:   Tue Jul 14 20:53:37 2026 +0200

    Correction pr106945

Diff:
---
 gcc/fortran/trans-array.cc | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 6d73b2370e90..3075cae8b6c4 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -10670,13 +10670,6 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, tree dest,
 	      else
 		nelems = build_int_cst (size_type_node, 1);
 
-	      if (CLASS_DATA (c)->attr.dimension
-		  || CLASS_DATA (c)->attr.codimension)
-		{
-		  src_data = gfc_conv_descriptor_data_get (src_data);
-		  dst_data = gfc_conv_descriptor_data_get (dst_data);
-		}
-
 	      gfc_init_block (&tmpblock);
 
 	      gfc_add_modify (&tmpblock, gfc_class_vptr_get (dcmp),
@@ -10710,9 +10703,17 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, tree dest,
 	      tmp = gfc_finish_block (&tmpblock);
 
 	      gfc_init_block (&tmpblock);
-	      gfc_add_modify (&tmpblock, dst_data,
-			      fold_convert (TREE_TYPE (dst_data),
-					    null_pointer_node));
+	      if (CLASS_DATA (c)->attr.dimension
+		  || CLASS_DATA (c)->attr.codimension)
+		{
+		  gfc_conv_descriptor_data_set (&tmpblock, dst_data,
+						null_pointer_node);
+		  src_data = gfc_conv_descriptor_data_get (src_data);
+		}
+	      else
+		gfc_add_modify (&tmpblock, dst_data,
+				fold_convert (TREE_TYPE (dst_data),
+					      null_pointer_node));
 	      null_data = gfc_finish_block (&tmpblock);
 
 	      null_cond = fold_build2_loc (input_location, NE_EXPR,
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.