From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9056 invoked by alias); 26 Nov 2012 07:57:59 -0000 Received: (qmail 8970 invoked by uid 48); 26 Nov 2012 07:57:34 -0000 From: "Joost.VandeVondele at mat dot ethz.ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/55469] New: memory leak on read with istat.ne.0 Date: Mon, 26 Nov 2012 07: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: X-Bugzilla-Severity: normal X-Bugzilla-Who: Joost.VandeVondele at mat dot ethz.ch 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-11/txt/msg02364.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55469 Bug #: 55469 Summary: memory leak on read with istat.ne.0 Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: Joost.VandeVondele@mat.ethz.ch The following testcase leads to memory leaks with gfortran 4.5/4.6/4.7/4.8 (as found by valgrind) 4.1 seems not to leak (but has a couple of warnings). REAL :: z INTEGER :: istat CHARACTER(LEN=3) :: t t="NVE" READ (UNIT=t,FMT=*,IOSTAT=istat) z END note that istat.NE.0 in this case. ==37422== 300 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==37422== at 0x4A057F4: calloc (vg_replace_malloc.c:593) ==37422== by 0x4C298FF: _gfortrani_xcalloc (memory.c:56) ==37422== by 0x4CE2A82: l_push_char.isra.2 (list_read.c:641) ==37422== by 0x4CE3223: read_real (list_read.c:1634) ==37422== by 0x4CE504E: _gfortrani_list_formatted_read (list_read.c:1895)