This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH, Fortran, alloc_poly, v2] Fix allocation of memory for polymorphic assignment
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Andre Vehreschild <vehre at gmx dot de>
- Cc: GCC-Patches-ML <gcc-patches at gcc dot gnu dot org>, GCC-Fortran-ML <fortran at gcc dot gnu dot org>, Damian Rouson <damian at sourceryinstitute dot org>
- Date: Thu, 22 Dec 2016 23:26:19 +0100
- Subject: Re: [PATCH, Fortran, alloc_poly, v2] Fix allocation of memory for polymorphic assignment
- Authentication-results: sourceware.org; auth=none
- References: <20161219124343.3c3baf4c@vepi2> <CAKwh3qhHNmDzweZX=mw-kp1S4ojnzFBEVWGZZW83tcHJBK2UyQ@mail.gmail.com> <20161220170750.6ef0d9d8@vepi2>
2016-12-20 17:07 GMT+01:00 Andre Vehreschild <vehre@gmx.de>:
> Hi Janus,
>
>> 1) After adding that code block in gfc_trans_assignment_1, it seems
>> like the comment above is outdated, right?
>
> Thanks for noting.
>
>> 2) Wouldn't it be better to move this block, which does the correct
>> allocation for CLASS variables, into
>> "alloc_scalar_allocatable_for_assignment", where the allocation for
>> all other cases is done?
>
> I tried to, but that would have meant to extend the interface of
> alloc_scalar_allocatable_for_assignment significantly, while at the location
> where I finally added the code, I could use the data available. Secondly
> putting the malloc at the correct location is not possible at alloc_scalar_...
> because the pre-blocks have already been joined to the body. That way the
> malloc was always placed either before even the vptr was set, or after the data
> was copied. Both options were quite hazardous.
>
> I now went to add the allocation into trans_class_assignment (). This allows
> even more reuse of already present and needed data, e.g., the vptr.
>
> Bootstrapped and regtested ok on x86_64-linux/f23. Ok for trunk?
Thanks for the explanations. The patch is ok with me in this form.
Cheers,
Janus