Patchwork Fix PR47411

login
register
mail settings
Submitter Richard Guenther
Date Jan. 25, 2011, 9:44 a.m.
Message ID <alpine.LNX.2.00.1101251043220.17230@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/80340/
State New
Headers show

Comments

Richard Guenther - Jan. 25, 2011, 9:44 a.m.
This should fix PR47411

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2011-01-25  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/47411
	Backport from mainline
	2010-06-30  Michael Matz  <matz@suse.de>

	PR bootstrap/44699
	* tree-vrp.c (vrp_finalize): Deal with changing num_ssa_names.
Eric Botcazou - Jan. 25, 2011, 10:07 a.m.
> This should fix PR47411
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Thanks.  There was a (platform-independent) testcase in the PR.

Patch

Index: gcc/tree-vrp.c
===================================================================
--- gcc/tree-vrp.c	(revision 161613)
+++ gcc/tree-vrp.c	(revision 161614)
@@ -7315,6 +7315,7 @@  vrp_finalize (void)
   size_t i;
   prop_value_t *single_val_range;
   bool do_value_subst_p;
+  unsigned num = num_ssa_names;
 
   if (dump_file)
     {
@@ -7326,10 +7327,10 @@  vrp_finalize (void)
   /* We may have ended with ranges that have exactly one value.  Those
      values can be substituted as any other const propagated
      value using substitute_and_fold.  */
-  single_val_range = XCNEWVEC (prop_value_t, num_ssa_names);
+  single_val_range = XCNEWVEC (prop_value_t, num);
 
   do_value_subst_p = false;
-  for (i = 0; i < num_ssa_names; i++)
+  for (i = 0; i < num; i++)
     if (vr_value[i]
 	&& vr_value[i]->type == VR_RANGE
 	&& vr_value[i]->min == vr_value[i]->max
@@ -7357,7 +7358,7 @@  vrp_finalize (void)
   identify_jump_threads ();
 
   /* Free allocated memory.  */
-  for (i = 0; i < num_ssa_names; i++)
+  for (i = 0; i < num; i++)
     if (vr_value[i])
       {
 	BITMAP_FREE (vr_value[i]->equiv);