https://gcc.gnu.org/g:4cca226316126395f4b7e7c62e96bd6cece9ddca

commit 4cca226316126395f4b7e7c62e96bd6cece9ddca
Author: Mikael Morin <[email protected]>
Date:   Tue Oct 14 11:19:12 2025 +0200

    Correction régression coarray_poly_9.f90

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

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 176ce86bb585..9b3fe8cb6891 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -2010,8 +2010,13 @@ is_assumed_rank (tree descriptor)
 void
 gfc_copy_descriptor (stmtblock_t *block, tree dest, tree src)
 {
-  if (GFC_BYTES_STRIDES_ARRAY_TYPE_P (TREE_TYPE (dest))
-      == GFC_BYTES_STRIDES_ARRAY_TYPE_P (TREE_TYPE (src)))
+  tree dest_type = TREE_TYPE (dest);
+  tree src_type = TREE_TYPE (src);
+
+  if (GFC_BYTES_STRIDES_ARRAY_TYPE_P (dest_type)
+      == GFC_BYTES_STRIDES_ARRAY_TYPE_P (src_type)
+      && TYPE_MAIN_VARIANT (dest_type)
+        == TYPE_MAIN_VARIANT (src_type))
     gfc_add_modify (block, dest, src);
   else
     {

Reply via email to