diff mbox

Fix PR rtl-optimization/68287

Message ID 56432401.3060501@suse.cz
State New
Headers show

Commit Message

Martin Liška Nov. 11, 2015, 11:18 a.m. UTC
Hi.

There's a fix for fallout of r230027.

Patch can bootstrap and survives regression tests on x86_64-linux-gnu.

Ready for trunk?
Thanks,
Martin

Comments

Richard Biener Nov. 11, 2015, 12:20 p.m. UTC | #1
On Wed, Nov 11, 2015 at 12:18 PM, Martin Liška <mliska@suse.cz> wrote:
> Hi.
>
> There's a fix for fallout of r230027.
>
> Patch can bootstrap and survives regression tests on x86_64-linux-gnu.

Hmm, but only the new elements are zeroed so this still is different
from previous behavior.
Note that the previous .create (...) doesn't initialize the elements
either (well, it's not supposed to ...).

I _think_ the bug is that you do safe_grow and use length while the
previous code just added
enough reserve (but not actual elements!).

Thus the fix would be to do

 point_freq_vec.truncate (0);
 point_freq_vec.reserve_exact (new_length);

Richard.

> Ready for trunk?
> Thanks,
> Martin
diff mbox

Patch

From 127d629991d92ea42a87b84e9d88612b84dbec03 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 11 Nov 2015 10:11:20 +0100
Subject: [PATCH 1/2] Fix PR rtl-optimization/68287

gcc/ChangeLog:

2015-11-11  Martin Liska  <mliska@suse.cz>

	PR rtl-optimization/68287
	* lra-lives.c (lra_create_live_ranges_1): Clear the vector
	with zeros.
---
 gcc/lra-lives.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 9453759..27887de 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -1242,7 +1242,7 @@  lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
   curr_point = 0;
   unsigned new_length = get_max_uid () * 2;
   if (point_freq_vec.length () < new_length)
-    point_freq_vec.safe_grow (new_length);
+    point_freq_vec.safe_grow_cleared (new_length);
   lra_point_freq = point_freq_vec.address ();
   int *post_order_rev_cfg = XNEWVEC (int, last_basic_block_for_fn (cfun));
   int n_blocks_inverted = inverted_post_order_compute (post_order_rev_cfg);
-- 
2.6.2