[gcc(refs/users/mikael/heads/refactor_descriptor_v01)] Correction dynamic_dispatch_6.f03

Mikael Morin mikael@gcc.gnu.org
Wed Mar 12 14:20:50 GMT 2025


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

commit dbc518c31fd3da3050ce399fb30ad951cddea8cf
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Tue Mar 11 15:21:14 2025 +0100

    Correction dynamic_dispatch_6.f03

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

diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index 3b818ba74fd4..53216a25847e 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -2863,7 +2863,11 @@ get_class_canonical_type (gfc_symbol *derived, int rank, int corank)
 
   gfc_find_symbol (class_name, ns, 0, &canonical_class);
   if (canonical_class)
-    gfc_resolve_symbol (canonical_class);
+    {
+      if (derived->module)
+	canonical_class->module = gfc_get_string ("%s", derived->module);
+      gfc_resolve_symbol (canonical_class);
+    }
 
   return canonical_class;
 }
@@ -3222,7 +3226,10 @@ gfc_get_derived_type (gfc_symbol * derived, int codimen)
     {
       gfc_symbol * canonical_sym = get_class_canonical_type (derived);
       if (canonical_sym != nullptr)
-	TYPE_CANONICAL (typenode) = gfc_get_derived_type (canonical_sym, codimen);
+	{
+	  tree canonical_sym_decl = gfc_get_derived_type (canonical_sym, codimen);
+	  TYPE_CANONICAL (typenode) = TYPE_CANONICAL (canonical_sym_decl);
+	}
       gfc_component * data_comp = derived->components;
       gfc_symbol *orig_type = data_comp->ts.u.derived;
       if (orig_type->attr.extension)


More information about the Gcc-cvs mailing list