public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/66079] [6 Regression] memory leak with source allocation in internal subprogram Date: Sat, 16 May 2015 15:32:00 -0000 [thread overview] Message-ID: <bug-66079-4-plyfqEuevf@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-66079-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66079 --- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> --- Created attachment 35555 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35555&action=edit Initial fix This is a partial fix, in that it deals with the initial problem. type subdata integer, allocatable :: b endtype block call newRealVec end block contains subroutine newRealVec type(subdata), allocatable :: d, e, f allocate(d,source=subdata(1)) ! was lost, now OK allocate(e,source=d) ! OK allocate(f,source=create (99)) ! 8 bytes go AWOL if (d%b .ne. 1) call abort if (e%b .ne. 1) call abort if (f%b .ne. 99) call abort f = create (42) ! another 8 bytes go AWOL print *, f%b end subroutine function create (arg) result(res) integer :: arg type(subdata), allocatable :: res allocate(res, source = subdata(arg)) end function end The function calls are losing the allocation for the subdata type itself. The b component is correctly dealt with. I know what has to be done to fix this. Arrays are a mess. allocate (d(2), source = subdata ()) ICEs on a double free allocate (d(2), source = [subdata (1), subdata (2)]) loses 8 bytes in two chunks. Watch this space. Paul
next prev parent reply other threads:[~2015-05-16 15:32 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-66079-4@http.gcc.gnu.org/bugzilla/> 2015-05-11 10:51 ` rguenth at gcc dot gnu.org 2015-05-16 8:24 ` pault at gcc dot gnu.org 2015-05-16 15:32 ` pault at gcc dot gnu.org [this message] 2015-05-18 1:36 ` damian at sourceryinstitute dot org 2015-05-21 4:25 ` pault at gcc dot gnu.org 2015-05-22 22:57 ` pault at gcc dot gnu.org 2015-06-11 15:50 ` pault at gcc dot gnu.org 2015-06-13 0:21 ` damian at sourceryinstitute dot org 2015-08-04 9:27 ` mikael at gcc dot gnu.org 2015-08-04 9:32 ` paul.richard.thomas at gmail dot com 2015-10-16 8:34 ` [Bug fortran/66079] [5 " rguenth at gcc dot gnu.org 2015-10-16 8:34 ` rguenth at gcc dot gnu.org 2015-10-18 18:37 ` pault at gcc dot gnu.org 2015-10-18 19:43 ` pault at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-66079-4-plyfqEuevf@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).