Hello,

Le 03/06/2013 16:06, Tobias Burnus a écrit :
> Dear all,
> 
> Due to copying the attributes, the temporary variable could get marked
> as function (attr.function, attr.flavor == FL_PROCEDURE). This either
> lead to leaking those attributes into the assembler file - or to cause
> an error due to the call to gfc_add_flavor. With this patch, I now
> explicitly unset those attribues.  (Fund when building ForTrilinos.)
> 

> diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
> index b2e8fdc..655d3c1 100644
> --- a/gcc/fortran/resolve.c
> +++ b/gcc/fortran/resolve.c
> @@ -9293,8 +9293,12 @@ get_temp_from_expr (gfc_expr *e, gfc_namespace *ns)
>       }
>      }
>  
>    /* Add the attributes and the arrayspec to the temporary.  */
>    /* Add the attributes and the arrayspec to the temporary.  */
>    tmp->n.sym->attr = gfc_expr_attr (e);
> +  tmp->n.sym->attr.function = 0;
> +  tmp->n.sym->attr.result = 0;
> +  tmp->n.sym->attr.flavor = FL_VARIABLE;
> +
>    if (as)
>      {
>        tmp->n.sym->as = gfc_copy_array_spec (as);

This fixes the problem, but shouldn't the fix be in gfc_expr_attr instead?
It seems to me that most symbol attributes don't make sense in any case
for non-variables, except for some of the standard ones
(allocatable,...) and possibly a couple more.

Mikael

Reply via email to