[Patch, Fortran] PR 42144: [OOP] deferred TBPs do not work

Janus Weil janus@gcc.gnu.org
Wed Dec 16 20:14:00 GMT 2009


Hi all,

here is a patch which fixes dynamic dispatch with deferred type-bound
procedures. On trunk, dynamic dispatch is currently handled such that
a TBP call on a CLASS variable is translated into a SWITCH statement,
which decides at runtime which version of the TBP to call, depending
on the dynamic type.

Now, if the base type is abstract, we can just skip it when building
the switch statement, since the dynamic type can never be abstract.
This also prevents us from calling deferred TBPs (which previously
resulted in linking failures, see PR).

The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


gcc/fortran/
2009-12-16 Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42144
	* trans-expr.c (select_class_proc): Skip abstract base types.

gcc/testsuite/
2009-12-16  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/42144
	* gfortran.dg/dynamic_dispatch_6.f03: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr42144.diff
Type: application/octet-stream
Size: 550 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091216/d47c67c4/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dynamic_dispatch_6.f03
Type: application/octet-stream
Size: 1871 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20091216/d47c67c4/attachment-0001.obj>


More information about the Fortran mailing list