This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [EXTERNAL] Re: [Patch, F03, RFC] FINAL support in 4.8


Hello,

Le 25/10/2012 16:16, Tobias Burnus a écrit :
>  ptr%component%universal%counter
> 
> For some reason, that's incompatible with how gfc_conv_variable works.
> For "ptr%component" everything is fine. One then has as "ref" the
> component ref to "universal":
> 
>         case REF_COMPONENT:
>           if (ref->u.c.sym->attr.extension)
>             conv_parent_component_references (se, ref);
>           gfc_conv_component_ref (se, ref);
> 
> As ref already is the "universal", the search for c->name "universal" in
> dt->components (with "dt = ref->u.c.sym") fails.
It shouldn't, as `ref.u.c.sym` is the parent type (i.e.
`ptr%component`'s type).


> patch.diff
> 
> 
> diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
> index b0bd7f5..4c7ff0a 100644
> --- a/gcc/fortran/trans-expr.c
> +++ b/gcc/fortran/trans-expr.c
> @@ -1510,6 +1519,9 @@ conv_parent_component_references (gfc_se * se, gfc_ref * ref)
>    dt = ref->u.c.sym;
>    c = ref->u.c.component;
>  
> +  if (c->name == dt->name)
> +    return;
> +
This shouldn't be necessary, as that case is caught by the following loop...

>    /* Return if the component is not in the parent type.  */
>    for (cmp = dt->components; cmp; cmp = cmp->next)
>      if (strcmp (c->name, cmp->name) == 0)
... here (when se.expr is ptr.component and ref is %universal).
By the way s/ not// in the comment.


Mikael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]