[Bug fortran/53310] New: [4.6/4.7/4.8 Regression] EOSHIFT leaks memory
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 10 20:57:00 GMT 2012
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
More information about the Gcc-bugs
mailing list