[Patch, Fortran, OOP] PR 49638: [OOP] length parameter is ignored when overriding type bound character functions with constant length.

Janus Weil janus@gcc.gnu.org
Thu Aug 4 21:42:00 GMT 2011


Hi all,

attached is a draft patch fixing the PR in the subject line and
extending the checks for overriding type-bound functions. It regtests
cleanly on x86_64-unknown-linux-gnu already, but I would like to have
some feedback.

The patch is rather large, but most of it is just mechanical, due to
the fact that I added an extra argument to 'gfc_dep_compare_expr'. I
use this function to compare the string-length expressions of a
character-valued TBP and an overriding procedure (the standard
requires them to be equal). Inside 'gfc_dep_compare_expr' I had to add
a minor piece to correctly respect commutativity of the multiplication
operator (for the addition operator this was done already). The extra
argument controls whether we check variable symbols for equality or
just their names. For the overriding checks it is sufficient to check
for names, because the arguments of the overriding procedure are
required to have the same names as in the base procedure.

Moreover I extended the type check in 'check_typebound_override' to
also check for correct rank, via 'compare_type_rank' instead of
'gfc_compare_types'. However, the former was local to interface.c, so
I made it public (and should probably also rename it to gfc_...), or
should one rather move 'check_typebound_override' to interface.c
itself? I think it fits in there pretty nicely. After all it is
checking the interfaces of overriding procedures.

Anything else missing for this patch? Or is it ok for trunk? (I will
add corresponding test cases and a ChangeLog, of course.)

Cheers,
Janus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr49638.diff
Type: text/x-diff
Size: 23327 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110804/d5acda0a/attachment.bin>


More information about the Fortran mailing list