Hello,

Le 10/05/2015 00:31, Thomas Koenig a écrit :
> Am 09.05.2015 um 13:59 schrieb Mikael Morin:
>>> +                 /* We have to get rid of the shape, if thre is one.  Do
>>> +                    so by freeing it and calling gfc_resolve to rebuild it,
>>> +                    if necessary.  */
>>> +                    
>>> +                 if (lbound_e->shape)
>>> +                   gfc_free_shape (&(lbound_e->shape), lbound_e->rank);
>>> +
>>
>>> +                 lbound_e->rank = ar->dimen;
>> ar->dimen is  not what you think it is.
>> It is 3 for array(1, 1, :), while the rank is 1.
> 
>> gfc_resolve_expr should set the rank for you, so just remove this line.
> 
> It doesn't (for whatever reason), so I kept on setting it.
It seems to work here.
In fact ar->dimen is the correct setting here, as the array is full.
But it will be overwritten (by the same value) in gfc_resolve_expr.
Anyway, it doesn't matter.

> 
>>> +                   
>>> +                 gfc_resolve_expr (lbound_e);
>>> +                 lbound = get_array_inq_function (GFC_ISYM_LBOUND,
>>> +                                                  lbound_e, i + 1);
>> free lbound_e?
> 
> It will be part of the lbound expression, or be simplified away.

get_array_inq_function makes a copy, so a _copy_ of lbound_e is in lbound.


>>> @@ -2639,6 +2665,8 @@ scalarized_expr (gfc_expr *e_in, gfc_expr **index,
>>>       i_index ++;
>>>     }
>>>      }
>>> +  gfc_free_expr (e_in);
>>> +
>> This side effect is asking for trouble.
>> Instead of this, remove the copies made in the callers.
>> This is independant from the rest, so it can be made later as a follow-up.
> 
> Done (all in once).
> 
e_in is a copy of ei and is used unmodified as input for the copy to
lbound_e, so it can be removed completely.

OK with that change.  Thanks.

Mikael

Reply via email to