Patchwork [PR,rtl-optimization/55604] : fix ICE in remove_some_program_points_and_update_live_ranges

login
register
mail settings
Submitter Aldy Hernandez
Date Dec. 5, 2012, 6:25 p.m.
Message ID <50BF9196.6060603@redhat.com>
Download mbox | patch
Permalink /patch/203919/
State New
Headers show

Comments

Aldy Hernandez - Dec. 5, 2012, 6:25 p.m.
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 <aldyh@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.

Patch

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)