26/02/2015 18:17, Andre Vehreschild a écrit :
> This first patch is only preparatory and does not change any of the semantics 
> of
> gfortran at all.
Sure?

> diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
> index ab6f7a5..d28cf77 100644
> --- a/gcc/fortran/expr.c
> +++ b/gcc/fortran/expr.c
> @@ -4059,10 +4060,10 @@ gfc_lval_expr_from_sym (gfc_symbol *sym)
>    lval->symtree = gfc_find_symtree (sym->ns->sym_root, sym->name);
>  
>    /* It will always be a full array.  */
> -  lval->rank = sym->as ? sym->as->rank : 0;
> +  as = sym->as;
> +  lval->rank = as ? as->rank : 0;
>    if (lval->rank)
> -    gfc_add_full_array_ref (lval, sym->ts.type == BT_CLASS ?
> -                         CLASS_DATA (sym)->as : sym->as);
> +    gfc_add_full_array_ref (lval, as);

This is a change of semantics.  Or do you know that sym->ts.type !=
BT_CLASS?


> diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
> index 3664824..e571a17 100644
> --- a/gcc/fortran/trans-decl.c
> +++ b/gcc/fortran/trans-decl.c
> @@ -1013,16 +1017,24 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree 
> dummy)
>    tree decl;
>    tree type;
>    gfc_array_spec *as;
> +  symbol_attribute *array_attr;
>    char *name;
>    gfc_packed packed;
>    int n;
>    bool known_size;
>  
> -  if (sym->attr.pointer || sym->attr.allocatable
> -      || (sym->as && sym->as->type == AS_ASSUMED_RANK))
> +  /* Use the array as and attr.  */
> +  as = sym->as;
> +  array_attr = &sym->attr;
> +
> +  /* The pointer attribute is always set on a _data component, therefore 
> check
> +     the sym's attribute only.  */
> +  if (sym->attr.pointer || array_attr->allocatable
> +      || (as && as->type == AS_ASSUMED_RANK))
>      return dummy;
>  
Any reason to sometimes use array_attr, sometimes not, like here?
By the way, the comment is misleading: for classes, there is the
class_pointer attribute (and it is a pain, I know).

Mikael

Reply via email to