diff mbox

[Committed,AArch64] Fix PR80671

Message ID AM5PR0802MB2610B8EC89C415E486A9435983EC0@AM5PR0802MB2610.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Wilco Dijkstra May 10, 2017, 11:11 a.m. UTC
Move an use-after-free access before the delete.

Committed as obvious.

ChangeLog:

2017-05-10  Wilco Dijkstra  <wdijkstr@arm.com>

	PR target/80671
	* config/aarch64/cortex-a57-fma-steering.c (merge_forest):
	Move member access before delete.
--
diff mbox

Patch

diff --git a/gcc/config/aarch64/cortex-a57-fma-steering.c b/gcc/config/aarch64/cortex-a57-fma-steering.c
index 4a3887984b4a0242b8a10bec0c6285ba184517ab..94d7f9c58692a417cba01720a7f05ec12b323c85 100644
--- a/gcc/config/aarch64/cortex-a57-fma-steering.c
+++ b/gcc/config/aarch64/cortex-a57-fma-steering.c
@@ -411,9 +411,9 @@  fma_forest::merge_forest (fma_forest *other_forest)
      the list of tree roots of ref_forest.  */
   this->m_globals->remove_forest (other_forest);
   this->m_roots->splice (this->m_roots->begin (), *other_roots);
-  delete other_forest;
-
   this->m_nb_nodes += other_forest->m_nb_nodes;
+
+  delete other_forest;
 }
 
 /* Dump information about the forest FOREST.  */