public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-6297] Fix memory leak in if-conversion
@ 2023-02-23 12:52 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-02-23 12:52 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:af46073dbe83d88e2d93d967da447346b22c70bb

commit r13-6297-gaf46073dbe83d88e2d93d967da447346b22c70bb
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Feb 23 11:05:47 2023 +0100

    Fix memory leak in if-conversion
    
    The following fixes if-conversion failing to release data-references
    and the data-reference vector.
    
            * tree-if-conv.cc (tree_if_conversion): Properly manage
            memory of refs and the contained data references.

Diff:
---
 gcc/tree-if-conv.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 0e384e36394..f133102ad33 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -3534,7 +3534,7 @@ tree_if_conversion (class loop *loop, vec<gimple *> *preds)
   auto_vec <gassign *, 4> writes_to_lower;
   bitmap exit_bbs;
   edge pe;
-  vec<data_reference_p> refs;
+  auto_vec<data_reference_p, 10> refs;
 
  again:
   rloop = NULL;
@@ -3544,7 +3544,6 @@ tree_if_conversion (class loop *loop, vec<gimple *> *preds)
   need_to_predicate = false;
   need_to_rewrite_undefined = false;
   any_complicated_phi = false;
-  refs.create (5);
 
   /* Apply more aggressive if-conversion when loop or its outer loop were
      marked with simd pragma.  When that's the case, we try to if-convert
@@ -3701,8 +3700,10 @@ tree_if_conversion (class loop *loop, vec<gimple *> *preds)
   data_reference_p dr;
   unsigned int i;
   for (i = 0; refs.iterate (i, &dr); i++)
-    free (dr->aux);
-
+    {
+      free (dr->aux);
+      free_data_ref (dr);
+    }
   refs.truncate (0);
 
   if (ifc_bbs)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-23 12:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 12:52 [gcc r13-6297] Fix memory leak in if-conversion Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).