Le 08/01/2025 à 18:23, Andre Vehreschild a écrit :

First of all the recursive attr must not be set on vtypes, neither on module
ones nor anywhere else. Strictly speaking is a vtype recursive, because by its
extends member it references itself through a pointer. But it is guaranteed
that the base type is never the same as the extended one. So no cycle can
occur. Furthermore are vtypes never freeed nor copied (yet). So the flag is not
needed which the patch starting with 0002 ensures.


From d0b43ccb141dbec998e81fd437f7f1a02bd74731 Mon Sep 17 00:00:00 2001
From: Andre Vehreschild <ve...@gcc.gnu.org>
Date: Wed, 8 Jan 2025 14:58:35 +0100
Subject: [PATCH 2/3] Fortran: Cylce detection for non vtypes only. [PR118337]

gcc/fortran/ChangeLog:

        PR fortran/118337

        * resolve.cc (resolve_fl_derived0): Exempt vtypes from cycle
        detection.
---
 gcc/fortran/resolve.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 6dcda70679f..dab0c3af601 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -16840,7 +16840,8 @@ resolve_fl_derived0 (gfc_symbol *sym)

   /* Resolving components below, may create vtabs for which the cyclic type
      information needs to be present.  */
-  resolve_cyclic_derived_type (sym);
+  if (!sym->attr.vtype)
+    resolve_cyclic_derived_type (sym);

   c = (sym->attr.is_class) ? CLASS_DATA (sym->components)
                           : sym->components;
--
2.47.1

OK.

Reply via email to