[Patch, fortran] PR80477 - [OOP] Polymorphic function result generates memory leak

Paul Richard Thomas paul.richard.thomas@gmail.com
Sat Jul 28 07:32:00 GMT 2018


Several attempts, including mine, were made to fix this bug since it
was posted. They were all attacking the wrong place. Instead of
providing the free of the class _data as part of the call to
'add_a_type' it should be included in the post block of the argument
processing in the call to 'assign_a_type'. The comment in the patch
says the rest.

Bootstrapped and regtested on FC28/x86_64 - OK for trunk?

Paul

2017-07-27  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/80477
    * trans-expr.c (gfc_conv_procedure_call): Allocatable class
    results being passed to a derived type formal argument must
    have the _data component deallocated after use.

2017-07-27  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/80477
    * gfortran.dg/class_result_7.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 3087 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180728/9d4f85fb/attachment.bin>


More information about the Fortran mailing list