On 23/08/2012 22:13, Tobias Burnus wrote:
> Tobias Burnus wrote:
>> I am now down to a single kind of failure: pointer_remapping_*.f08
>> fails. One has code like:
>>      ptr(1:5, 1:2) => arr
>>
>> The question is how to solve that one. If one removes the AR_FULL and
>> sets lse.descriptor_only, the test cases fail; nevetheless, I wonder
>> whether something along those lines could be the solution.
> 
> That's what I do now: I added descriptor_only support to
> gfc_conv_expr_descriptor.
> 
> The attached patch build and regtested successfully on x86-64-gnu-linux.
> OK for the trunk?
> 
OK with...


> diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
> index 8c254dd..891fab4 100644
> --- a/gcc/fortran/trans-array.c
> +++ b/gcc/fortran/trans-array.c
> @@ -510,10 +510,24 @@ gfc_free_ss_chain (gfc_ss * ss)
>  static void
>  free_ss_info (gfc_ss_info *ss_info)
>  {
> +  int n;
> +
>    ss_info->refcount--;
>    if (ss_info->refcount > 0)
>      return;
>  
> +  switch (ss_info->type)
> +    {
> +    case GFC_SS_SECTION:
> +      for (n = 0; n < GFC_MAX_DIMENSIONS; n++)
> +     if (ss_info->data.array.subscript[n])
> +       gfc_free_ss_chain (ss_info->data.array.subscript[n]);
> +      break;
> +
> +    default:
> +      break;
> +    }
> +
>    gcc_assert (ss_info->refcount == 0);
>    free (ss_info);
>  }
... could you move the switch after the assert, and ...

> @@ -6382,6 +6419,16 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * 
> expr, gfc_ss * ss)
>    ss_type = ss_info->type;
>    ss_expr = ss_info->expr;
>  
> +  /* Special case: TRANSPOSE which needs no temporary.  */
> +  if (expr->expr_type == EXPR_FUNCTION && expr->value.function.isym
> +      && expr->value.function.isym->id == GFC_ISYM_TRANSPOSE
> +      && NULL != (arg = gfc_get_noncopying_intrinsic_argument (expr)))
> +    {
> +      /* This is a call to transpose which has already been handled by the
> +      scalarizer, so that we just need to get its argument's descriptor.  */
> +      expr = expr->value.function.actual->expr;
> +    }
> +
... make this a while loop...

> @@ -6457,7 +6505,8 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, 
> gfc_ss * ss)
>         gcc_assert (expr->value.function.isym->id == GFC_ISYM_TRANSPOSE);
>         /* ... which has already been handled by the scalarizer, so
>            that we just need to get its argument's descriptor.  */
> -       gfc_conv_expr_descriptor (se, expr->value.function.actual->expr, ss);
> +       gfc_free_ss_chain (ss);
> +       gfc_conv_expr_descriptor (se, expr->value.function.actual->expr);
>         return;
>       }
>  
... so that this part can be removed completely.

Many thanks.
Mikael

PS: My name can be removed from the ChangeLog

Reply via email to