diff mbox

Fix memory leak in vect_create_vectorized_promotion_stmts (PR middle-end/56461)

Message ID 20130301201009.GF12913@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek March 1, 2013, 8:10 p.m. UTC
Hi!

4.7 did here:
  VEC_free (tree, heap, *vec_oprnds0);
  *vec_oprnds0 = vec_tmp;
so vec_oprnds0->truncate (0) doesn't match that, and leaks memory.

Fixed thusly, 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 (vect_create_vectorized_promotion_stmts): Call
	vec_oprnds0->release (); rather than vec_oprnds0->truncate (0)
	before overwriting it.


	Jakub

Comments

Diego Novillo March 1, 2013, 8:53 p.m. UTC | #1
On Fri, Mar 1, 2013 at 3:10 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> 4.7 did here:
>   VEC_free (tree, heap, *vec_oprnds0);
>   *vec_oprnds0 = vec_tmp;
> so vec_oprnds0->truncate (0) doesn't match that, and leaks memory.
>
> Fixed thusly, 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 (vect_create_vectorized_promotion_stmts): Call
>         vec_oprnds0->release (); rather than vec_oprnds0->truncate (0)
>         before overwriting it.

OK.


Diego.
diff mbox

Patch

--- gcc/tree-vect-stmts.c.jj	2013-03-01 12:39:08.000000000 +0100
+++ gcc/tree-vect-stmts.c	2013-03-01 13:33:37.796121184 +0100
@@ -2269,7 +2269,7 @@  vect_create_vectorized_promotion_stmts (
       vec_tmp.quick_push (new_tmp2);
     }
 
-  vec_oprnds0->truncate (0);
+  vec_oprnds0->release ();
   *vec_oprnds0 = vec_tmp;
 }