From patchwork Wed Dec 5 18:25:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PR, rtl-optimization/55604] : fix ICE in remove_some_program_points_and_update_live_ranges Date: Wed, 05 Dec 2012 08:25:26 -0000 From: Aldy Hernandez X-Patchwork-Id: 203919 Message-Id: <50BF9196.6060603@redhat.com> To: "Vladimir N. Makarov" Cc: gcc-patches On 12/05/12 12:13, Aldy Hernandez wrote: > 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? Errr, another ChangeLog oops. Cut and paste error fixed. Sorry. commit fcb644db593ee78855a0fac1a76f11478a359d1d 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)