Hi Paul,

Am 23.11.24 um 17:05 schrieb Paul Richard Thomas:
Hi All,

I was going through some of the older regressions and found pr84674, which
was distinctly low hanging fruit because the contributor has found the
offending bit of code. However, buried in this PR, on the grounds that it
looked similar, was what has now become pr117730. This was quite difficult
to diagnose and the cause of the problem was only found by instrumenting
class.c (add_proc_comp) to check the order in which non_overridable
procedure components were added to the vtables of derived type extensions
that are in different modules to the parent. Failure to keep the order the
same results, of course, in the wrong procedure being called.

The fixes for these PRs verge on 'obvious' but I thought that I should
submit them to the list because I want to push and backport them together.
Although PR117730 is not a regression, I think that it is sufficiently
limiting that it should be backported to active branches.

they are indeed almost obvious and fix possibly annoying wrong-code
issues.

OK for mainline and, after a week or two, backporting to 13- and
14-branches/

OK for mainline and backports.

Thanks for the patch!

Harald

Paul

Fortran: Fix non_overridable typebound proc problems [PR84674/117730].

2024-11-23  Paul Thomas  <pa...@gcc.gnu.org>

gcc/fortran/ChangeLog

PR fortran/117730
* class.c (add_proc_comp): Only reject a non_overridable if it
has no overridden procedure and the component is already
present in the vtype.
PR fortran/84674
* resolve.cc (resolve_fl_derived): Do not build a vtable for a
derived type extension that is completely empty.

gcc/testsuite/ChangeLog

PR fortran/117730
* gfortran.dg/pr117730_a.f90: New test.
* gfortran.dg/pr117730_b.f90: New test.

PR fortran/84674
* gfortran.dg/pr84674.f90: New test.


Reply via email to