From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7486 invoked by alias); 10 May 2012 20:55:47 -0000 Received: (qmail 7475 invoked by uid 22791); 10 May 2012 20:55:46 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BG X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 May 2012 20:55:33 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/53310] New: [4.6/4.7/4.8 Regression] EOSHIFT leaks memory Date: Thu, 10 May 2012 20:57:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg01136.txt.bz2 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