[PATCH] Fix lots of uninitialized memory uses in sched_analyze_reg (take 2)

Jakub Jelinek jakub@redhat.com
Mon Mar 4 22:27:00 GMT 2013


On Mon, Mar 04, 2013 at 11:17:41PM +0100, Steven Bosscher wrote:
> On Mon, Mar 4, 2013 at 10:17 PM, Jakub Jelinek wrote:
> > Something that again hits lots of testcases during valgrind checking
> > bootstrap.  init_alias_analysis apparently does
> >   vec_safe_grow_cleared (reg_known_value, maxreg - FIRST_PSEUDO_REGISTER);
> >   reg_known_equiv_p = sbitmap_alloc (maxreg - FIRST_PSEUDO_REGISTER);
> > but doesn't bitmap_clear (reg_known_equiv_p), perhaps as an optimization?
> 
> No, an incorrect replacement with sbitmap. We used to have:
> 
>   reg_known_equiv_p = XCNEWVEC (bool, reg_known_value_size);
> 
> I'm probably to blame for this one, actually :-)

This works too on the testcase (e.g. gcc.dg/54455.c).

Will bootstrap/regtest it overnight.

2013-03-04  Jakub Jelinek  <jakub@redhat.com>

	* alias.c (init_alias_analysis): Clear reg_known_equiv_p bitmap.

--- gcc/alias.c.jj	2013-01-18 12:49:31.000000000 +0100
+++ gcc/alias.c	2013-03-04 23:22:38.865751120 +0100
@@ -2812,6 +2812,7 @@ init_alias_analysis (void)
 
   vec_safe_grow_cleared (reg_known_value, maxreg - FIRST_PSEUDO_REGISTER);
   reg_known_equiv_p = sbitmap_alloc (maxreg - FIRST_PSEUDO_REGISTER);
+  bitmap_clear (reg_known_equiv_p);
 
   /* If we have memory allocated from the previous run, use it.  */
   if (old_reg_base_value)


	Jakub



More information about the Gcc-patches mailing list