From: Richard Biener Date: Wed, 10 Feb 2021 08:06:26 +0000 (+0100) Subject: tree-optimization/99024 - fix leak in loop vect analysis X-Git-Tag: upstream/12.2.0~9789 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d997565c41a8a5783bf076437208f38d8ea39ced;p=platform%2Fupstream%2Fgcc.git tree-optimization/99024 - fix leak in loop vect analysis When we analyzed a loop as epilogue but later in peeling decide we're not going to use it then in the DTOR we clear the original loops ->aux which causes us to leak the main loop vinfo. Fixed by only clearing aux if it is associated with the vinfo we're destroying. 2021-02-10 Richard Biener PR tree-optimization/99024 * tree-vect-loop.c (_loop_vec_info::~_loop_vec_info): Only clear loop->aux if it is associated with the destroyed loop_vinfo. --- diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index f1f16e3..27845c0 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -927,7 +927,11 @@ _loop_vec_info::~_loop_vec_info () delete scan_map; epilogue_vinfos.release (); - loop->aux = NULL; + /* When we release an epiloge vinfo that we do not intend to use + avoid clearing AUX of the main loop which should continue to + point to the main loop vinfo since otherwise we'll leak that. */ + if (loop->aux == this) + loop->aux = NULL; } /* Return an invariant or register for EXPR and emit necessary