http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49241

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-31 
12:36:23 UTC ---
The memory the program needs increases continuously as "top" shows; it takes
about 5min on my computer before the OS kills it (out of memory).

If one does not use an endless loop but a finite loop, it shows no leakage with
neither valgrind nor totalview. Also the result seems to be fine - except that
the memory consumption simply grows ...

Slightly reduced test case:

program ala
   implicit none
   type :: array_of_foo
      real, dimension(:), allocatable :: p
   end type array_of_foo
   type(array_of_foo), dimension(:), allocatable :: tab
   integer :: i

   do
      allocate(tab(0:1))
      allocate(tab(0)%p(0))
      tab(1)%p = [(i,i=1,10)] ! Realloc-on assignment (fine!)
      tab(0)%p = [tab(0)%p, tab(1)%p] ! << realloc-on-assignment. Culprit?
      deallocate(tab)
   end do
end program ala

Reply via email to