On 6/24/26 2:57 AM, Mikael Morin wrote:
Hello,

Le 23/06/2026 à 23:24, Jerry D a écrit :
diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc
index adf392cec6f..c10484ff636 100644
--- a/gcc/fortran/trans.cc
+++ b/gcc/fortran/trans.cc
@@ -524,8 +524,13 @@ gfc_build_array_ref (tree base, tree offset, tree decl,
       span = gfc_vptr_size_get (vptr);

       /* Check if this is an unlimited polymorphic object carrying a character
-     payload. In this case, the 'len' field is non-zero.  */
-      if (decl && GFC_CLASS_TYPE_P (TREE_TYPE (decl)))
+     payload. In this case, the 'len' field is non-zero.  The class
+     container type does not always carry GFC_CLASS_TYPE_P, but its
+     canonical type does.  */
+      if (decl
+      && (GFC_CLASS_TYPE_P (TREE_TYPE (decl))
+          || (TYPE_CANONICAL (TREE_TYPE (decl))
+          && GFC_CLASS_TYPE_P (TYPE_CANONICAL (TREE_TYPE (decl))))))
     span = gfc_resize_class_size_with_len (NULL, decl, span);
     }
   else if (decl)
this hunk isn't needed any more, I think, or is it?  It was the very purpose of the GFC_CLASS_TYPE_P business to drop this change.

Otherwise OK.

Thanks.



Thanks for catching that, I was focused on other work and forgot to delete it.

It is removed and all of the gfortran.dg passes. I am rebasing on the remote master and doing a complete rebuild and rerun for regressions. If all passes, I will push to mainline.

Thanks for you reviews and feedback.

Best regards,

Jerry

Reply via email to