[PR83320] Fix new/free mismatch issue

Message ID DB5PR0801MB2742EDF572F46448FD3C145AE7300@DB5PR0801MB2742.eurprd08.prod.outlook.com
State New
Headers show
Series
  • [PR83320] Fix new/free mismatch issue
Related show

Commit Message

Bin Cheng Dec. 8, 2017, 5:49 p.m.
Hi,
While I am still trying to reproduce and verify the issue (valgrind checking runs very slow for me),
It's clear I made stupid mistake using free for newed vector.  This simple patch fixes it.
Bootstrap and test ongoing.  Is it OK?

Thanks,
bin
2017-12-06  Bin Cheng  <bin.cheng@arm.com>

	PR tree-optimization/83320
	* gimple-loop-interchange.cc (free_data_refs_with_aux): Use delete.
	(prune_datarefs_not_in_loop): Ditto.

Comments

Richard Biener Dec. 8, 2017, 7:16 p.m. | #1
On December 8, 2017 6:49:21 PM GMT+01:00, Bin Cheng <Bin.Cheng@arm.com> wrote:
>Hi,

>While I am still trying to reproduce and verify the issue (valgrind

>checking runs very slow for me),

>It's clear I made stupid mistake using free for newed vector.  This

>simple patch fixes it.

>Bootstrap and test ongoing.  Is it OK?


OK. 

Richard. 

>Thanks,

>bin

>2017-12-06  Bin Cheng  <bin.cheng@arm.com>

>

>	PR tree-optimization/83320

>	* gimple-loop-interchange.cc (free_data_refs_with_aux): Use delete.

>	(prune_datarefs_not_in_loop): Ditto.

Patch

diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc
index 3f7c54f..92c96a3 100644
--- a/gcc/gimple-loop-interchange.cc
+++ b/gcc/gimple-loop-interchange.cc
@@ -945,7 +945,7 @@  free_data_refs_with_aux (vec<data_reference_p> datarefs)
     if (dr->aux != NULL)
       {
 	DR_ACCESS_STRIDE (dr)->release ();
-	free (dr->aux);
+	delete (vec<tree> *) dr->aux;
       }
 
   free_data_refs (datarefs);
@@ -1843,7 +1843,7 @@  prune_datarefs_not_in_loop (struct loop *loop, vec<data_reference_p> datarefs)
 	  if (dr->aux)
 	    {
 	      DR_ACCESS_STRIDE (dr)->release ();
-	      free (dr->aux);
+	      delete (vec<tree> *) dr->aux;
 	    }
 	  free_data_ref (dr);
 	}