This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/78492] [OOP] Compiler segfault with non_overridable function in generic interface
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 Nov 2016 13:13:50 +0000
- Subject: [Bug fortran/78492] [OOP] Compiler segfault with non_overridable function in generic interface
- Auto-submitted: auto-generated
- References: <bug-78492-4@http.gcc.gnu.org/bugzilla/>
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.