https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78443
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
> So, what goes wrong is probably the assignment of the TBPs in the vtab.
We simply fail to set the TBP entry for 'square' in the vtabs of C1 and C2.
This patch fixes it and regtests cleanly:
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c (Revision 242657)
+++ gcc/fortran/class.c (Arbeitskopie)
@@ -751,9 +751,6 @@ add_proc_comp (gfc_symbol *vtype, const char *name
{
gfc_component *c;
- if (tb->non_overridable)
- return;
-
c = gfc_find_component (vtype, name, true, true, NULL);
if (c == NULL)
With this, the output of the test case becomes ...
square( 2.00000000 ) = -100.000000
square( 2.00000000 ) = 4.00000000
square( 2.00000000 ) = 4.00000000
... which I believe is correct.
Note: The patch may be a bit too strong, but it does no harm. There are cases
where one can avoid having a TBP entry in the vtab, namely if the
non-overridable procedure itself is not overriding a procedure from the parent
class. I'll try to create an improved patch which implements such as check.