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/78492] [OOP] Compiler segfault with non_overridable function in generic interface


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

--- Comment #3 from janus at gcc dot gnu.org ---
I think what happens is this: After resolving the generic TBP call to the
specific one, we try to generate a polymorphic call, but that fails since the
vtab does not contain an entry for the non-overridable TBP.

A simple workaround is to do what had already been proposed for PR78443, namely
generate a vtab entry for each TBP, no matter if it's overridable or not:


Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (revision 242725)
+++ gcc/fortran/class.c (working copy)
@@ -751,9 +751,6 @@
 {
   gfc_component *c;

-  if (tb->non_overridable && !tb->overridden)
-    return;
-
   c = gfc_find_component (vtype, name, true, true, NULL);

   if (c == NULL)


That seems to work well and makes both comment #2 and comment #0 compile and
run without error.

However, a better fix would be to generate a non-polymorphic call after
resolving the generic, just as in the case where no generics TBPs are involved.

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