https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97652

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following works with and without -flto (fixes the endless loop without
and the execute fail with)

diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index b7129dcbe6d..4643fff243f 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2647,6 +2647,8 @@ gfc_get_derived_type (gfc_symbol * derived, int codimen)
       typenode = make_node (RECORD_TYPE);
       TYPE_NAME (typenode) = get_identifier (derived->name);
       TYPE_PACKED (typenode) = flag_pack_derived;
+      if (!got_canonical)
+       SET_TYPE_STRUCTURAL_EQUALITY (typenode);
       derived->backend_decl = typenode;
     }

Reply via email to