public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "damian at sourceryinstitute dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/65925] New: Memory leak with source allocation nested inside the source of another source allocation
Date: Wed, 29 Apr 2015 07:28:00 -0000	[thread overview]
Message-ID: <bug-65925-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65925

            Bug ID: 65925
           Summary: Memory leak with source allocation nested inside the
                    source of another source allocation
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org
  Target Milestone: ---

Valgrind reports a memory leak with the code below for gfortran 6.0.0 (and 4.10
and 5.0.0):

$ cat reduced-gforLeak.f90 
type IndexSpace
end type
type,extends(IndexSpace) :: OuterProductSpace
end type
type base
  class(IndexSpace),allocatable :: b
end type
type,extends(base) :: subdata
endtype
class(base),allocatable :: d
allocate(d,source = newData())
contains
   type(subdata) function newData() 
      allocate(newData%base%b,source = OuterProductSpace())
   end function
end
$ gfortran reduced-gforLeak.f90 
$ valgrind ./a.out
==3960== Memcheck, a memory error detector
==3960== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==3960== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==3960== Command: ./a.out
==3960== 
==3960== 
==3960== HEAP SUMMARY:
==3960==     in use at exit: 17 bytes in 3 blocks
==3960==   total heap usage: 28 allocs, 25 frees, 12,692 bytes allocated
==3960== 
==3960== LEAK SUMMARY:
==3960==    definitely lost: 17 bytes in 2 blocks
==3960==    indirectly lost: 0 bytes in 1 blocks
==3960==      possibly lost: 0 bytes in 0 blocks
==3960==    still reachable: 0 bytes in 0 blocks
==3960==         suppressed: 0 bytes in 0 blocks
==3960== Rerun with --leak-check=full to see details of leaked memory
==3960== 
==3960== For counts of detected and suppressed errors, rerun with: -v
==3960== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
$ gfortran --version
GNU Fortran (GCC) 6.0.0 20150422 (experimental)


             reply	other threads:[~2015-04-29  7:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29  7:28 damian at sourceryinstitute dot org [this message]
2015-05-08 23:45 ` [Bug fortran/65925] " damian at sourceryinstitute dot 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-65925-4@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: link
Be 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).