https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64986
--- Comment #13 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> --- Dear Mikael, A good principle in general is to assume cock-up, rather than conspiracy :-) The reason for this spreading between two functions is incremental development done at very different times. If you can see a way to rationalize the implementation, please do it. Many thanks for the patch - assume that it is OK for trunk and 5.x Paul On 22 July 2015 at 18:24, mikael at gcc dot gnu.org <gcc-bugzi...@gcc.gnu.org> wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64986 > > --- Comment #12 from Mikael Morin <mikael at gcc dot gnu.org> --- > (In reply to Dominique d'Humieres from comment #6) >> The test has been introduced at revision r220482, > > That revision adds interesting comments: > >> /* For a function with a class array result, save the result as >> a temporary, set the info fields needed by the scalarizer and >> call the finalization function of the temporary. Note that the >> nullification of allocatable components needed by the result >> is done in gfc_trans_assignment_1. */ > > and in gfc_trans_assignment_1, there is: > >> /* Nullify the allocatable components corresponding to those of the lhs >> derived type, so that the finalization of the function result does not >> affect the lhs of the assignment. Prepend is used to ensure that the >> nullification occurs before the call to the finalizer. > > > So, if finalization for derived types with allocatable components means > freeing > the allocatable components, the above is more or less a justification for the > patch in comment #9. > > What I don't understand is why there is need for two functions > gfc_conv_procedure_call and gfc_trans_assignment_1 doing half of the job, and > why deallocation of components, deallocation of whole allocatable and > finalization are not handled all at once in a single place. > > -- > You are receiving this mail because: > You are on the CC list for the bug.