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] expmed.c: Fix a read acesss to uninitialized memory.


Hi,

Attached is a patch to fix a read acesss to uninitialized memory.

Consider the recursive call to synth_mult shown in the patch.  Right
above that, note that we forget to initialize new_limit.latency, which
later causes a read acesss to uninitialized memory.

Found by valgrind while compiling combine.c.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-12-10  Kazu Hirata  <kazu@cs.umass.edu>

	* expmed.c (synth_mult): Initialize new_limit.latency before
	making a recursive call.

Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.213
diff -u -d -p -r1.213 expmed.c
--- expmed.c	9 Dec 2004 20:28:14 -0000	1.213
+++ expmed.c	10 Dec 2004 07:07:25 -0000
@@ -2660,7 +2660,7 @@ synth_mult (struct algorithm *alg_out, u
 	    op_latency = add_cost[mode];
 
 	  new_limit.cost = best_cost.cost - op_cost;
-	  new_limit.cost = best_cost.cost - op_latency;
+	  new_limit.latency = best_cost.cost - op_latency;
 	  synth_mult (alg_in, t / d, &new_limit, mode);
 
 	  alg_in->cost.cost += op_cost;


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