From patchwork Wed Feb 27 16:03:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 223645 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 4DF6E2C0089 for ; Thu, 28 Feb 2013 03:04:15 +1100 (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=1362585855; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=e1nXZRYcoRegT0ro/1tT gxyU+0U=; b=F9MqsScU4HpyQQUmSdhRbWwHro5IpH0Uyp9fMpPVv78YDguDkgLW TybpWGFsYruy14x/9G0sfFgNJa++RII8ryFszvl4Qni6yz9wrGWwTrt2abEvlnuS A2Q3LsXAHNTR4BDprMOemfdiuAuS4uD7imd0h7ZKbvoCULcv5F/L17g= 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:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Zq0YVbwybZ6Q5JFImenxSJfvCCo3yRp4OVVagfLHCHInAN9R9NirmRrB8lQqnf FNQJW+Me+4I0Lxh2jYZsqFjo8yLZ+RvMHwrztVVk2Q0Udcf+EmoFi+RSLoe810Px ox0vDOFx0xglcPcYA6iG9+fI3lFRv2859P40FlEfEO1j0=; Received: (qmail 15453 invoked by alias); 27 Feb 2013 16:04:04 -0000 Received: (qmail 15418 invoked by uid 22791); 27 Feb 2013 16:04:01 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Feb 2013 16:03:56 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1RG3uHH011382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Feb 2013 11:03:56 -0500 Received: from zalov.cz (vpn1-7-146.ams2.redhat.com [10.36.7.146]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1RG3s3A015859 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 27 Feb 2013 11:03:55 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r1RG3r5F004067; Wed, 27 Feb 2013 17:03:53 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r1RG3rcq004066; Wed, 27 Feb 2013 17:03:53 +0100 Date: Wed, 27 Feb 2013 17:03:53 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ipa-pure-const memory leak (PR middle-end/56461) Message-ID: <20130227160353.GM12913@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 Hi! The release_node hook is only called when a cgraph node is removed, not when it merely gets ->analyzed field cleared. If that happens on some node that has_function_state, we leak the memory. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2013-02-27 Jakub Jelinek PR middle-end/56461 * ipa-pure-const.c (propagate): Use FOR_EACH_FUNCTION instead of FOR_EACH_DEFINED_FUNCTION when freeing state. Jakub --- gcc/ipa-pure-const.c.jj 2013-02-08 13:16:55.000000000 +0100 +++ gcc/ipa-pure-const.c 2013-02-27 11:20:54.876786950 +0100 @@ -1479,7 +1479,7 @@ propagate (void) propagate_pure_const (); /* Cleanup. */ - FOR_EACH_DEFINED_FUNCTION (node) + FOR_EACH_FUNCTION (node) if (has_function_state (node)) free (get_function_state (node)); funct_state_vec.release ();