https://gcc.gnu.org/g:c39f1eaf4a0627bac948885f6ad59ebba56a4279

commit c39f1eaf4a0627bac948885f6ad59ebba56a4279
Author: Mikael Morin <[email protected]>
Date:   Fri Oct 3 16:19:43 2025 +0200

    Correction ICE pr88624.f90

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

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 920d97e29999..0c33ea20991c 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -2273,18 +2273,17 @@ gfc_set_descriptor (stmtblock_t *block, tree dest, tree 
src, gfc_expr *src_expr,
     {
       tmp = INDIRECT_REF_P (src) ? TREE_OPERAND (src, 0) : src;
       if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (tmp)))
-       {
-         tmp = gfc_conv_descriptor_token (tmp);
-       }
+       tmp = gfc_conv_descriptor_token (tmp);
       else if (DECL_P (tmp) && DECL_LANG_SPECIFIC (tmp)
               && GFC_DECL_TOKEN (tmp) != NULL_TREE)
        tmp = GFC_DECL_TOKEN (tmp);
+      else if (TYPE_LANG_SPECIFIC (TREE_TYPE (tmp)))
+       tmp = GFC_TYPE_ARRAY_CAF_TOKEN (TREE_TYPE (tmp));
       else
-       {
-         tmp = GFC_TYPE_ARRAY_CAF_TOKEN (TREE_TYPE (tmp));
-       }
+       tmp = NULL_TREE;
 
-      gfc_conv_descriptor_token_set (block, dest, tmp);
+      if (tmp != NULL_TREE)
+       gfc_conv_descriptor_token_set (block, dest, tmp);
     }
 }

Reply via email to