public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53310] New: [4.6/4.7/4.8 Regression] EOSHIFT leaks memory
@ 2012-05-10 20:57 burnus at gcc dot gnu.org
  2012-05-10 21:06 ` [Bug fortran/53310] [4.5/4.6/4.7/4.8 " dominiq at lps dot ens.fr
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-05-10 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53310
           Summary: [4.6/4.7/4.8 Regression] EOSHIFT leaks memory
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: tkoenig@gcc.gnu.org


https://groups.google.com/forum/?fromgroups#!topic/comp.lang.fortran/DAzRG_a6wkg
shows that gfortran leaks memory.

The following program leaks 6 MB per iteration. It shows no valgrind failues
with gfortran 4.1.2 but with 4.3 and later it leaks memory. For 4.8, valgrind
shows that the memory is allocated in the library.

I do not have GCC 4.3's libgfortran at hand - only the compiler itself. But I
can re-produce the leakage with GCC 4.6/4.7/4.8's libgfortran. I don't know
whether 4.3 to 4.5 are affected or not.


Valgrind shows:

2,097,152 bytes in 1 blocks are definitely lost in loss record 1 of 2
  at 0x4C2ABED: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  by 0x4E4ECE4: _gfortrani_xmalloc (memory.c:39)
  by 0x4F1DEE4: eoshift2 (eoshift2.c:95)
  by 0x4F1E0F1: _gfortran_eoshift2_4 (in
/projects/tob/gcc-git/gcc-trunk/lib64/libgfortran.so.3.0.0)
  by 0x4014D9: MAIN__ (gh444.f90:21)
  by 0x401910: main (gh444.f90:25)

4,194,304 bytes in 2 blocks are possibly lost in loss record 2 of 2
  at 0x4C2ABED: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
  by 0x4E4ECE4: _gfortrani_xmalloc (memory.c:39)
  by 0x4F1DEE4: eoshift2 (eoshift2.c:95)
  by 0x4F1E0F1: _gfortran_eoshift2_4 (in
/projects/tob/gcc-git/gcc-trunk/lib64/libgfortran.so.3.0.0)
  by 0x4014D9: MAIN__ (gh444.f90:21)
  by 0x401910: main (gh444.f90:25)

LEAK SUMMARY:
  definitely lost: 2,097,152 bytes in 1 blocks
  indirectly lost: 0 bytes in 0 blocks
    possibly lost: 4,194,304 bytes in 2 blocks



PROGRAM eo_test

  INTEGER, PARAMETER :: pp=SELECTED_REAL_KIND(6)
  INTEGER :: x, y, z, dmn, step
  REAL(pp), ALLOCATABLE, DIMENSION(:,:,:,:) :: D
  REAL(pp), DIMENSION(:,:,:,:), ALLOCATABLE, TARGET :: buffer
  REAL(pp), DIMENSION(:,:,:), POINTER :: lower
  REAL :: tt

  y=1024; x=8; z=8; dmn=8
  ALLOCATE( buffer(y,z,dmn,6) )
  ALLOCATE( D(y,z,x,dmn) )
  lower => buffer(:,:,:,3)

  D(:,:,:,:) = 1.0_pp

step = 1
!DO step = 1, 1 !1000  
  tt=REAL(step)
  buffer(:,:,:,:) = tt*SIN(tt)
  D(:,:,:,:) = EOSHIFT(D(:,:,:,:),-1, lower(:,:,:), DIM=3)
  WRITE(*,*) 'Step, max(D):', tt,MAXVAL( D(:,:,:,:) )
!END DO

END PROGRAM eo_test


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

end of thread, other threads:[~2013-02-27 11:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-10 20:57 [Bug fortran/53310] New: [4.6/4.7/4.8 Regression] EOSHIFT leaks memory burnus at gcc dot gnu.org
2012-05-10 21:06 ` [Bug fortran/53310] [4.5/4.6/4.7/4.8 " dominiq at lps dot ens.fr
2012-05-10 21:47 ` burnus at gcc dot gnu.org
2012-05-11  8:23 ` burnus at gcc dot gnu.org
2012-05-11 22:34 ` burnus at gcc dot gnu.org
2012-05-11 22:39 ` burnus at gcc dot gnu.org
2012-05-11 23:11 ` burnus at gcc dot gnu.org
2012-05-12  0:15 ` burnus at gcc dot gnu.org
2013-02-27 11:10 ` dominiq at lps dot ens.fr

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