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 <al...@redhat.com>
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)

Reply via email to