public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65925] New: Memory leak with source allocation nested inside the source of another source allocation
@ 2015-04-29  7:28 damian at sourceryinstitute dot org
  2015-05-08 23:45 ` [Bug fortran/65925] " damian at sourceryinstitute dot org
  0 siblings, 1 reply; 2+ messages in thread
From: damian at sourceryinstitute dot org @ 2015-04-29  7:28 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug fortran/65925] Memory leak with source allocation nested inside the source of another source allocation
  2015-04-29  7:28 [Bug fortran/65925] New: Memory leak with source allocation nested inside the source of another source allocation damian at sourceryinstitute dot org
@ 2015-05-08 23:45 ` damian at sourceryinstitute dot org
  0 siblings, 0 replies; 2+ messages in thread
From: damian at sourceryinstitute dot org @ 2015-05-08 23:45 UTC (permalink / raw)
  To: gcc-bugs

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

Damian Rouson <damian at sourceryinstitute dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Damian Rouson <damian at sourceryinstitute dot org> ---
This was a false alarm.  Wrapping the following lines inside a bloc construct
eliminates the erroneous valgrind report.

class(base),allocatable :: d
allocate(d,source = newData())

Damian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-08 23:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29  7:28 [Bug fortran/65925] New: Memory leak with source allocation nested inside the source of another source allocation damian at sourceryinstitute dot org
2015-05-08 23:45 ` [Bug fortran/65925] " damian at sourceryinstitute dot org

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).