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] |
Hi all, the patch in the attachment fixes a memory leak by auto-deallocating the allocatable components of an allocatable intent(out) argument. Regtests cleanly on x86_64-linux-gnu. Ok for trunk? Cheers, Janus 2017-04-22 Janus Weil <janus@gcc.gnu.org> PR fortran/80121 * trans-types.c (gfc_conv_procedure_call): Deallocate the components of allocatable intent(out) arguments. 2017-04-22 Janus Weil <janus@gcc.gnu.org> PR fortran/80121 * gfortran.dg/intent_out_9.f90: New test case.
Attachment:
pr80121.diff
Description: Text document
! { dg-do compile } ! { dg-options "-fdump-tree-original" } ! ! PR 80121: Memory leak with derived-type intent(out) argument ! ! Contributed by Andrew Wood <andrew@fluidgravity.co.uk> PROGRAM p IMPLICIT NONE TYPE t1 INTEGER, ALLOCATABLE :: i(:) END TYPE call leak CONTAINS SUBROUTINE s1(e) TYPE(t1), ALLOCATABLE, INTENT(OUT) :: e(:) ALLOCATE( e(1) ) ALLOCATE( e(1)%i(2) ) END SUBROUTINE SUBROUTINE leak TYPE(t1), ALLOCATABLE :: e(:) CALL s1(e) CALL s1(e) END SUBROUTINE END PROGRAM ! { dg-final { scan-tree-dump-times "__builtin_free" 6 "original" } } ! { dg-final { cleanup-tree-dump "original" } }
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |