diff mbox

Fix uninitialised variable warning in tree-ssa-loop-ivcanon.c

Message ID 535004BC.1040701@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov April 17, 2014, 4:43 p.m. UTC
Hi all,

While looking at the build logs I noticed a warning while building tree-ssa-loop-ivcanon.c about a potential use of an uninitialised variable.
This patchlet fixes that warning by initialising it to 0.

Tested arm-none-eabi.

Ok for trunk?

2014-04-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
	Initialise n_unroll to 0.

Comments

Jeff Law May 9, 2014, 7:36 p.m. UTC | #1
On 04/17/14 10:43, Kyrill Tkachov wrote:
> Hi all,
>
> While looking at the build logs I noticed a warning while building
> tree-ssa-loop-ivcanon.c about a potential use of an uninitialised variable.
> This patchlet fixes that warning by initialising it to 0.
>
> Tested arm-none-eabi.
>
> Ok for trunk?
>
> 2014-04-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>      * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
>      Initialise n_unroll to 0.
So did you do a thorough analysis to verify that it was a false positive 
or that it was a valid warning?

For the former, it would be helpful if you filed a BZ.  We track these 
false positives for -Wuninitialized and do try to correct them.  If the 
latter then is using 0 for the initializer the safe thing to do?

Jeff
diff mbox

Patch

diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index cdf1559..7a83b12 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -656,7 +656,7 @@  try_unroll_loop_completely (struct loop *loop,
 			    HOST_WIDE_INT maxiter,
 			    location_t locus)
 {
-  unsigned HOST_WIDE_INT n_unroll, ninsns, max_unroll, unr_insns;
+  unsigned HOST_WIDE_INT n_unroll = 0, ninsns, max_unroll, unr_insns;
   gimple cond;
   struct loop_size size;
   bool n_unroll_found = false;