This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/80392] [5/6/7 Regression] [OOP] ICE with allocatable polymorphic function result in a procedure pointer component


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |janus at gcc dot gnu.org

--- Comment #3 from janus at gcc dot gnu.org ---
We already have a check to prevent this kind of infinite recursion (as shown in
comment #1) in gfc_get_derived_type, however it is apparently only working for
TYPEs, but not for CLASSes. This patch should fix it (and makes comment #0 and
comment #2 compile fine with trunk):

Index: gcc/fortran/trans-types.c
===================================================================
--- gcc/fortran/trans-types.c   (revision 246933)
+++ gcc/fortran/trans-types.c   (working copy)
@@ -2617,9 +2617,10 @@ gfc_get_derived_type (gfc_symbol * derived, int co
         the same as derived, by forcing the procedure pointer component to
         be built as if the explicit interface does not exist.  */
       if (c->attr.proc_pointer
-         && ((c->ts.type != BT_DERIVED && c->ts.type != BT_CLASS)
-              || (c->ts.u.derived
-                  && !gfc_compare_derived_types (derived, c->ts.u.derived))))
+         && (c->ts.type != BT_DERIVED || (c->ts.u.derived
+                   && !gfc_compare_derived_types (derived, c->ts.u.derived)))
+         && (c->ts.type != BT_CLASS || (CLASS_DATA (c)->ts.u.derived
+                   && !gfc_compare_derived_types (derived, CLASS_DATA
(c)->ts.u.derived))))
        field_type = gfc_get_ppc_type (c);
       else if (c->attr.proc_pointer && derived->backend_decl)
        {


Regtesting now ...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]