Message ID | AANLkTikNh=kEXum+n1skAGieLAEZYJeujXhz3oo++r-W@mail.gmail.com |
---|---|
State | New |
Headers | show |
Janus, > The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk? > Yes, as discussed off-list, it looks OK to me. Get it committed asap! Thanks for the patch Paul > > > 2011-03-12 Janus Weil <janus@gcc.gnu.org> > > PR fortran/48059 > * trans-expr.c (gfc_apply_interface_mapping_to_expr): Replace base type > for polymorphic arguments. > > 2011-03-12 Janus Weil <janus@gcc.gnu.org> > > PR fortran/48059 > * gfortran.dg/class_41.f03: New. >
On 03/12/2011 03:16 AM, Janus Weil wrote: > Hi all, > > the attached patch fixes the PR in the subject line. The problem was > the following: During the interface mapping for a procedure call we > need to take special care of polymorphic arguments, since the type of > the actual argument can differ from the type of the formal argument. > Therefore we need to replace the base type of component references by > the actual type (in particular to get parent references right). > > The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk? > Yes, thanks for patch! Jerry
>> The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk? >> > > Yes, as discussed off-list, it looks OK to me. Get it committed asap! Thanks. Committed as r170906. Cheers, Janus
Index: gcc/fortran/trans-expr.c =================================================================== --- gcc/fortran/trans-expr.c (revision 170879) +++ gcc/fortran/trans-expr.c (working copy) @@ -2247,6 +2247,10 @@ gfc_apply_interface_mapping_to_expr (gfc_interface expr->symtree = sym->new_sym; else if (sym->expr) gfc_replace_expr (expr, gfc_copy_expr (sym->expr)); + /* Replace base type for polymorphic arguments. */ + if (expr->ref && expr->ref->type == REF_COMPONENT + && sym->expr && sym->expr->ts.type == BT_CLASS) + expr->ref->u.c.sym = sym->expr->ts.u.derived; } /* ...and to subexpressions in expr->value. */