This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Avoid using uninitialized var in tree_loop_linear (PR tree-optimization/42931)


Hi!

nb_iter isn't initialized if !res.  We don't use the result of
double_int_mul in that case, but still there is no point to call
double_int_mul with the uninitialized argument.

Bootstrapped/regtested on x86_64-linux and i686-linux, will commit
to trunk/4.4 as obvious.

2010-02-08  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/42931
	* tree-loop-linear.c (try_interchange_loops): Don't call
	double_int_mul if estimated_loop_iterations failed.

--- gcc/tree-loop-linear.c.jj	2009-11-25 16:47:35.000000000 +0100
+++ gcc/tree-loop-linear.c	2010-02-08 12:20:59.000000000 +0100
@@ -246,9 +246,10 @@ try_interchange_loops (lambda_trans_matr
 	res = cmp < 0 ?
 	  estimated_loop_iterations (loop_j, false, &nb_iter):
 	  estimated_loop_iterations (loop_i, false, &nb_iter);
-	large = double_int_mul (large, nb_iter);
 
-	if (res && double_int_ucmp (large, l1_cache_size) < 0)
+	if (res
+	    && double_int_ucmp (double_int_mul (large, nb_iter),
+				l1_cache_size) < 0)
 	  continue;
 
 	if (dependence_steps_i < dependence_steps_j

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]