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

commit e6414782db562911bfda8876d40a01fcf8550251
Author: Mikael Morin <[email protected]>
Date:   Thu Oct 15 22:38:32 2026 +0200

    correction partielle contiguous_15

Diff:
---
 gcc/fortran/trans-expr.cc | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 3cb1b719fe0b..5f585be8326a 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -8276,6 +8276,30 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                   is only that the span be the element length.  */
                {
                  bool whole_span = is_whole_span_addressed_dummy (e);
+                 if (!whole_span && IS_POINTER (e->symtree->n.sym))
+                   whole_span = true;
+                 bool polymorphic_current_type = e->symtree->n.sym->ts.type == 
BT_CLASS;
+                 for (gfc_ref *r = e->ref; r; r = r->next)
+                   {
+                     if (whole_span)
+                       break;
+                     if (r->type != REF_COMPONENT)
+                       continue;
+                     if (polymorphic_current_type)
+                       {
+                         polymorphic_current_type = false;
+                         continue;
+                       }
+                     gfc_component *comp = r->u.c.component;
+                     bool polymorphic_next_type = comp->ts.type == BT_CLASS
+                                                  && 
comp->ts.u.derived->attr.is_class;
+                     if ((polymorphic_next_type
+                          && CLASS_DATA (r->u.c.component)->attr.class_pointer)
+                         || (!polymorphic_next_type
+                             && r->u.c.component->attr.pointer))
+                       whole_span = true;
+                     polymorphic_current_type = polymorphic_next_type;
+                   }
                  gfc_conv_subref_array_arg (&parmse, e, nodesc_arg,
                                fsym ? fsym->attr.intent : INTENT_INOUT,
                                fsym && fsym->attr.pointer, fsym, sym->name,

Reply via email to