From patchwork Mon Aug 27 12:14:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 180187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 59DB82C00BF for ; Mon, 27 Aug 2012 22:14:55 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1346674496; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=pTZTexquBCJc4uYCBskk D0pX5Cc=; b=GdeVWzE0Vb7gJQO66+EuPcdq4+JNcr9ENasYX7t4wRS3at+sGzsd aOKu8SCxmTv1Gt91eEtfUQE0CUfsnC0wzFHHIXymuNhy9vAUl7ythbcHes11mYAz r3OtG5Ld553EqbpBSsXYdyWiJ6jO8WERS4BF8jVklWj7Aot6a0e3vhg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=wdmDWJM/Fe2hg2ph61I42V/w+gQE1M+vOYjrdn1idlLp19PYSrs0a+Hiocvy6W 1Hn6QTHD3U6RT+v0qpTZdSP3hZoMhV+6phnKTkOjCJ5geRYCZuaInkLxGKJNvRVX auTFxHPI9sZzD6cU3eynlWRIsMwjQQogbfqFYNx8Mk8ag=; Received: (qmail 25497 invoked by alias); 27 Aug 2012 12:14:45 -0000 Received: (qmail 25477 invoked by uid 22791); 27 Aug 2012 12:14:44 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Aug 2012 12:14:31 +0000 Received: from [192.168.178.22] (port-92-204-67-8.dynamic.qsc.de [92.204.67.8]) by mx02.qsc.de (Postfix) with ESMTP id 2F1442412C; Mon, 27 Aug 2012 14:14:24 +0200 (CEST) Message-ID: <503B649E.5040509@net-b.de> Date: Mon, 27 Aug 2012 14:14:22 +0200 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: gcc patches , gfortran Subject: Re: [Patch, Fortran] Plug memory leaks; fix tree-check ICE for PR References: <503A6726.9020404@net-b.de> In-Reply-To: <503A6726.9020404@net-b.de> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 08/26/2012 08:12 PM, Tobias Burnus wrote: > This patch fixes one ICE and several memory leaks. But there are more. > I have now committed the patch with the following additional patch * module.c (mio_symbol): Don't increase sym->refs for its use in sym->formal_ns->proc_name. The patch for the ICE (PR54370) was committed as Rev. 190709, the rest (memory leakage, including PR41093) as Rev. 190710. The additional patch is required as otherwise sym->refs is too high for gfc_free_symbol - and gfc_free_namespace doesn't free (and thus decrement) ns->proc_name. I have regtested and tested the patch with a couple of programs, I also checked some with valgrind; the leakage decreased quit a bit but there are still known leaks, cf. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54384 I do hope that the patch didn't cause any regression, but I do not rule out problems in some special situations as the memory handling is not always that transparent. Tobias --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -3807,10 +3807,7 @@ mio_symbol (gfc_symbol *sym) { mio_namespace_ref (&sym->formal_ns); if (sym->formal_ns) - { - sym->formal_ns->proc_name = sym; - sym->refs++; - } + sym->formal_ns->proc_name = sym; } /* Save/restore common block links. */