[PATCH] Fix memory leak in vectorizable_conversion (PR middle-end/56461)

Jakub Jelinek jakub@redhat.com
Fri Mar 1 20:06:00 GMT 2013


Hi!

For the modifier == NONE && !slp_node case we call vect_get_vec_defs, so
we overwrite vec_oprnds0, thus we shouldn't allocate it.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

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

	PR middle-end/56461
	* tree-vect-stmts.c (vectorizable_conversion): Don't call
	vec_oprnds0.create (1) for modifier == NONE.

--- gcc/tree-vect-stmts.c.jj	2013-03-01 11:59:03.000000000 +0100
+++ gcc/tree-vect-stmts.c	2013-03-01 12:39:08.521188115 +0100
@@ -2616,15 +2616,13 @@ vectorizable_conversion (gimple stmt, gi
 
   if (!slp_node)
     {
-      if (modifier == NONE)
-	vec_oprnds0.create (1);
-      else if (modifier == WIDEN)
+      if (modifier == WIDEN)
 	{
 	  vec_oprnds0.create (multi_step_cvt ? vect_pow2(multi_step_cvt) : 1);
 	  if (op_type == binary_op)
 	    vec_oprnds1.create (1);
 	}
-      else
+      else if (modifier == NARROW)
 	vec_oprnds0.create (
 		   2 * (multi_step_cvt ? vect_pow2 (multi_step_cvt) : 1));
     }

	Jakub



More information about the Gcc-patches mailing list