https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117730
--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to anlauf from comment #6)
> I looked at the fortran dump, and also at the verbose asm, comparing
> with and w/o non_overridable.
....snip....
> Could that be related to child_reset being invoked, although it should not?
I had come to a similar conclusion and so instrumented class.cc(add_proc_comp).
As a result, the following fix emerged and is regtesting as I write:
diff --git a/gcc/fortran/class.cc b/gcc/fortran/class.cc
index fc709fec322..388891a2fd5 100644
--- a/gcc/fortran/class.cc
+++ b/gcc/fortran/class.cc
@@ -886,11 +886,12 @@ add_proc_comp (gfc_symbol *vtype, const char *name,
gfc_typebound_proc *tb)
{
gfc_component *c;
- if (tb->non_overridable && !tb->overridden)
- return;
c = gfc_find_component (vtype, name, true, true, NULL);
+ if (tb->non_overridable && !tb->overridden && c)
+ return;
+
if (c == NULL)
{
/* Add procedure component. */