From patchwork Wed Dec 5 18:13:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 203917 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 4A5942C009F for ; Thu, 6 Dec 2012 05:13:54 +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=1355336036; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=zhhhyHw 9dBPz/pI4GnkTXbzJ2e8=; b=I0YUcU3xZyeKIssu55OXwGfOLRi2L3sqRq3Q0G3 MibNnVfviq8+4EUJOSQqYf+GxgOt19E2xcpD8nCr1aBnUs4fns7Vtg/cmNlAUt+R vcPUqMfoYNBkMe6NR/pdLPCiJQ8wn2hifOFHaTnqKUgarW35SdCEnQzWM8QuMxse rHQg= 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:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Zeorxi7AhimYAx2zSy2gzOczq/1bi3Y9uWljcdQRcOr9uwoARX6MQq+iUhOxR4 yfuzYaWhnhgrq7pdrePLUqA7UxWsjhDrSf6KO0azbO5S9S2f0HZTGW7qo35rIDCp 9WZZ2TFrnEwFUtpW4GWuLbmkkpb2s+oh7p7aPDLZ6oq7I=; Received: (qmail 27623 invoked by alias); 5 Dec 2012 18:13:48 -0000 Received: (qmail 27612 invoked by uid 22791); 5 Dec 2012 18:13:47 -0000 X-SWARE-Spam-Status: No, hits=-6.3 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, 05 Dec 2012 18:13:38 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qB5IDbLD010071 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 5 Dec 2012 13:13:37 -0500 Received: from reynosa.quesejoda.com (vpn-11-205.rdu.redhat.com [10.11.11.205]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qB5IDZKp013730; Wed, 5 Dec 2012 13:13:36 -0500 Message-ID: <50BF8ECF.4010804@redhat.com> Date: Wed, 05 Dec 2012 12:13:35 -0600 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: "Vladimir N. Makarov" CC: gcc-patches Subject: [PR rtl-optimization/55604]: fix ICE in remove_some_program_points_and_update_live_ranges 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 This is a division by zero ICE. In the testcase in the PR, both `n' and `lra_live_max_point' are zero. I have opted to inhibit the dump when lra_live_max_point is zero, but I can just as easily avoiding printing the percentage in this case. Let me know what you prefer. OK for trunk? commit 6b366d44e7d30d3a24eda07fcb43fc20e2aa7102 Author: Aldy Hernandez Date: Wed Dec 5 12:06:01 2012 -0600 PR rtl-optimization/55604 * lra-lives.c * (remove_some_program_points_and_update_live_ranges): Avoiding division by zero when dumping live range compression. diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c index c79b95b..46146ca 100644 --- a/gcc/lra-lives.c +++ b/gcc/lra-lives.c @@ -811,7 +811,7 @@ remove_some_program_points_and_update_live_ranges (void) sbitmap_free (born); sbitmap_free (dead); n++; - if (lra_dump_file != NULL) + if (lra_dump_file != NULL && lra_live_max_point) fprintf (lra_dump_file, "Compressing live ranges: from %d to %d - %d%%\n", lra_live_max_point, n, 100 * n / lra_live_max_point); if (n < lra_live_max_point)