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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
The following hack makes the code compile:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 166b702cd9a..16813853b30 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -16102,6 +16116,10 @@ resolve_symbol (gfc_symbol *sym)
       specification_expr = saved_specification_expr;
     }

+  // Hackish fix-up for a CLASS result variable
+  if (sym->ts.type == BT_CLASS && sym->result && sym->result->attr.class_ok)
+    sym->attr.class_ok = sym->result->attr.class_ok;
+
   if (sym->ts.type == BT_CLASS && sym->attr.class_ok && sym->ts.u.derived
       && CLASS_DATA (sym))
     {


Not sure yet where this should have been properly set in the first place...

Reply via email to