Patchwork fix -Werror=maybe-uninitialized in tree-ssa-loop-ivopts.c (PR bootstrap/50218)

login
register
mail settings
Submitter Mikael Pettersson
Date Aug. 28, 2011, 9:43 a.m.
Message ID <20058.3499.858364.515931@pilspetsen.it.uu.se>
Download mbox | patch
Permalink /patch/111900/
State New
Headers show

Comments

Mikael Pettersson - Aug. 28, 2011, 9:43 a.m.
The recent r178104 change to tree-ssa-loop-ivopts.c broke bootstrap on i686-linux
because stage2 gcc considers the variable 'comp' used but possibly uninitialized,
see PR50218.  Initializing it to ERROR_MARK solves the problem, and is consistent
with how other parts of r178104 represent absent/impossible 'comp' values.

Ok for trunk?  (I don't have svn write access.)

/Mikael

gcc/

2011-08-20  Mikael Pettersson  <mikpe@it.uu.se>

	PR bootstrap/50218
	* tree-ssa-loop-ivopts.c (determine_use_iv_cost_condition): Initialize comp.
Tom de Vries - Aug. 28, 2011, 10:30 a.m.
Richard,
Zdenek,

On 08/28/2011 11:43 AM, Mikael Pettersson wrote:
> The recent r178104 change to tree-ssa-loop-ivopts.c broke bootstrap on i686-linux
> because stage2 gcc considers the variable 'comp' used but possibly uninitialized,
> see PR50218.  Initializing it to ERROR_MARK solves the problem, and is consistent
> with how other parts of r178104 represent absent/impossible 'comp' values.
> 
> Ok for trunk?  (I don't have svn write access.)
> 
> /Mikael
> 
> gcc/
> 

If you can ok this, I'll check it in.

Thanks,
- Tom

> 2011-08-20  Mikael Pettersson  <mikpe@it.uu.se>
> 
> 	PR bootstrap/50218
> 	* tree-ssa-loop-ivopts.c (determine_use_iv_cost_condition): Initialize comp.
> 
> --- gcc-4.7-20110827/gcc/tree-ssa-loop-ivopts.c.~1~	2011-08-26 15:36:28.000000000 +0200
> +++ gcc-4.7-20110827/gcc/tree-ssa-loop-ivopts.c	2011-08-28 10:13:34.000000000 +0200
> @@ -4757,7 +4757,7 @@ determine_use_iv_cost_condition (struct 
>    bool ok;
>    int elim_inv_expr_id = -1, express_inv_expr_id = -1, inv_expr_id;
>    tree *control_var, *bound_cst;
> -  enum tree_code comp;
> +  enum tree_code comp = ERROR_MARK;
>  
>    /* Only consider real candidates.  */
>    if (!cand->iv)
Jakub Jelinek - Aug. 28, 2011, 11:40 a.m.
On Sun, Aug 28, 2011 at 12:30:56PM +0200, Tom de Vries wrote:
> > Ok for trunk?  (I don't have svn write access.)
> > 
> > /Mikael
> > 
> > gcc/
> > 
> 
> If you can ok this, I'll check it in.

This is fine.

> > 2011-08-20  Mikael Pettersson  <mikpe@it.uu.se>
> > 
> > 	PR bootstrap/50218
> > 	* tree-ssa-loop-ivopts.c (determine_use_iv_cost_condition): Initialize comp.
> > 
> > --- gcc-4.7-20110827/gcc/tree-ssa-loop-ivopts.c.~1~	2011-08-26 15:36:28.000000000 +0200
> > +++ gcc-4.7-20110827/gcc/tree-ssa-loop-ivopts.c	2011-08-28 10:13:34.000000000 +0200
> > @@ -4757,7 +4757,7 @@ determine_use_iv_cost_condition (struct 
> >    bool ok;
> >    int elim_inv_expr_id = -1, express_inv_expr_id = -1, inv_expr_id;
> >    tree *control_var, *bound_cst;
> > -  enum tree_code comp;
> > +  enum tree_code comp = ERROR_MARK;
> >  
> >    /* Only consider real candidates.  */
> >    if (!cand->iv)

	Jakub

Patch

--- gcc-4.7-20110827/gcc/tree-ssa-loop-ivopts.c.~1~	2011-08-26 15:36:28.000000000 +0200
+++ gcc-4.7-20110827/gcc/tree-ssa-loop-ivopts.c	2011-08-28 10:13:34.000000000 +0200
@@ -4757,7 +4757,7 @@  determine_use_iv_cost_condition (struct 
   bool ok;
   int elim_inv_expr_id = -1, express_inv_expr_id = -1, inv_expr_id;
   tree *control_var, *bound_cst;
-  enum tree_code comp;
+  enum tree_code comp = ERROR_MARK;
 
   /* Only consider real candidates.  */
   if (!cand->iv)