[Patch, Fortran, OOP] PR 78443: Incorrect behavior with non_overridable keyword

Janus Weil janus@gcc.gnu.org
Tue Nov 22 12:15:00 GMT 2016


Hi all,

here is a patch for a wrong-code problem with non_overridable
type-bound procedures. For details see the PR. Regtests cleanly. Ok
for trunk?

Since the patch is very simple and it fixes wrong code which can
silently give bad runtime results, I think backporting to the release
branches might be a good idea as well. Ok?

Cheers,
Janus


2016-11-22  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/78443
    * class.c (add_proc_comp): Add a vtype component for non-overridable
    procedures that are overriding.

2016-11-22  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/78443
    * gfortran.dg/typebound_proc_35.f90: New test case.
-------------- next part --------------
Index: gcc/fortran/class.c
===================================================================
--- gcc/fortran/class.c	(Revision 242657)
+++ gcc/fortran/class.c	(Arbeitskopie)
@@ -751,7 +751,7 @@ add_proc_comp (gfc_symbol *vtype, const char *name
 {
   gfc_component *c;
 
-  if (tb->non_overridable)
+  if (tb->non_overridable && !tb->overridden)
     return;
 
   c = gfc_find_component (vtype, name, true, true, NULL);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: typebound_proc_35.f90
Type: text/x-fortran
Size: 1918 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20161122/a4d7d46b/attachment.bin>


More information about the Fortran mailing list