[VRP] Allocate bitmap before copying

Message ID 788a88b5-4e57-d910-3824-f89f6883f929@linaro.org
State New
Headers show

Commit Message

kugan Oct. 8, 2016, 7:34 p.m.
Hi,

In vrp_intersect_ranges_1, when !vr0->equiv, we are copying vr1->equiv 
without allocating bitmap. This patch fixes this.

Bootstrap and regression testing are ongoing. Is this OK if no new 
regressions?

Thanks,
Kugan

gcc/ChangeLog:

2016-10-09  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* tree-vrp.c (vrp_intersect_ranges_1): Allocate bitmap before
	  copying.

Patch hide | download patch | download mbox

From ccd2fcb909f54f85858f18652abc3a387321f9a1 Mon Sep 17 00:00:00 2001
From: Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
Date: Sat, 8 Oct 2016 20:23:28 +1100
Subject: [PATCH 2/7] Alloc bitmap

---
 gcc/tree-vrp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 46bbd82..e758ae4 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -8622,7 +8622,10 @@  vrp_intersect_ranges_1 (value_range *vr0, value_range *vr1)
   if (vr0->equiv && vr1->equiv && vr0->equiv != vr1->equiv)
     bitmap_ior_into (vr0->equiv, vr1->equiv);
   else if (vr1->equiv && !vr0->equiv)
-    bitmap_copy (vr0->equiv, vr1->equiv);
+    {
+      vr0->equiv = BITMAP_ALLOC (&vrp_equiv_obstack);
+      bitmap_copy (vr0->equiv, vr1->equiv);
+    }
 }
 
 void
-- 
2.7.4