From 33e2d6f8bae92f2009f882ba5d1cb7a9534f45be Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Wed, 10 May 2017 11:01:26 +0000 Subject: [PATCH] Move an use-after-free access before the delete. gcc/ PR target/80671 * config/aarch64/cortex-a57-fma-steering.c (merge_forest): Move member access before delete. From-SVN: r247831 --- gcc/ChangeLog | 6 ++++++ gcc/config/aarch64/cortex-a57-fma-steering.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 454203cde92..30a8202aafc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-05-10 Wilco Dijkstra + + PR target/80671 + * config/aarch64/cortex-a57-fma-steering.c (merge_forest): + Move member access before delete. + 2017-05-10 Alexandre Oliva * tree-inline.c (expand_call_inline): Split block at stmt diff --git a/gcc/config/aarch64/cortex-a57-fma-steering.c b/gcc/config/aarch64/cortex-a57-fma-steering.c index 4a3887984b4..94d7f9c5869 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. */ -- 2.30.2