http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48059

--- Comment #9 from paul.richard.thomas at gmail dot com <paul.richard.thomas 
at gmail dot com> 2011-03-11 15:51:31 UTC ---
Janus,

That looks like the right way to go.  Do you understand how this can
be a regression, whilst the correct interface mapping was previously
not present :-)  ?

Cheers

Paul

On Fri, Mar 11, 2011 at 4:39 PM, janus at gcc dot gnu.org
<gcc-bugzi...@gcc.gnu.org> wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48059
>
> janus at gcc dot gnu.org changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Status|NEW                         |ASSIGNED
>         AssignedTo|unassigned at gcc dot       |janus at gcc dot gnu.org
>                   |gnu.org                     |
>
> --- Comment #8 from janus at gcc dot gnu.org 2011-03-11 15:39:20 UTC ---
> (In reply to comment #7)
>> > So, it wants to get at the a_type.length member, but applies the whole
>> > thing to a b_type'd variable.
>>
>> Yes, the base type in the reference is wrong. And the reason for this seems 
>> to
>> be that it is not corrected in the interface mapping. I think we need to 
>> extend
>> 'gfc_apply_interface_mapping_to_ref' to set the correct base type for
>> polymorphic arguments.
>
> The following seems to do the trick (not regtested yet):
>
> Index: trans-expr.c
> ===================================================================
> --- trans-expr.c        (revision 170870)
> +++ trans-expr.c        (working copy)
> @@ -2247,6 +2247,9 @@ 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)
> +         expr->ref->u.c.sym = sym->expr->ts.u.derived;
>       }
>
>       /* ...and to subexpressions in expr->value.  */
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
>

Reply via email to