This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, fortran] PR83567 - Parametrized derived types: Segmentation fault when assigning a function return value


Hi All,

This patch is very straightforward. The PR itself was fixed by not
freeing the parameterized components on leaving function scope. The
lhs expression in the assignment had pointers to parameterized
components that were overwritten on assignment, thereby causing some
memory leakage. This is fixed in trans-expr.c by deallocating them
before assignment.

Bootstrapped and regtested on FC23/x86_64 - OK for trunk? I will
commit in 24 hours if I receive no contrary comments.

Paul

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

    PR fortran/83567
    * trans-expr.c (gfc_trans_assignment_1): Free parameterized
    components of the lhs if dealloc is set.
    *trans-decl.c (gfc_trans_deferred_vars): Do not free the
    parameterized components of function results on leaving scope.


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

    PR fortran/83567
    * gfortran.dg/pdt_26.f90 : New test.

Attachment: submit.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]