public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/97346] IPA reference reference_vars_to_consider leaks
Date: Wed, 10 Feb 2021 10:54:10 +0000	[thread overview]
Message-ID: <bug-97346-4-6fGkQqHqnZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97346-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97346

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
So like the following?  Note the leak is the allcoation from ipa_init
being not released when we do the vec_alloc in
ipa_reference_write_optimization_summary (maybe this function wants to
use its own private vector?!)

diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 2ea2a6d5327..328fa8f732c 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -966,8 +966,7 @@ propagate (void)
       ipa_ref_var_info_summaries = NULL;
     }

-  if (dump_file)
-    vec_free (reference_vars_to_consider);
+  vec_free (reference_vars_to_consider);
   reference_vars_to_consider = NULL;
   return remove_p ? TODO_remove_functions : 0;
 }
@@ -1059,7 +1058,7 @@ ipa_reference_write_optimization_summary (void)
   auto_bitmap ltrans_statics;
   int i;

-  vec_alloc (reference_vars_to_consider, ipa_reference_vars_uids);
+  vec_truncate (reference_vars_to_consider, 0);
   reference_vars_to_consider->safe_grow (ipa_reference_vars_uids, true);

   /* See what variables we are interested in.  */
@@ -1117,7 +1116,8 @@ ipa_reference_write_optimization_summary (void)
          }
       }
   lto_destroy_simple_output_block (ob);
-  delete reference_vars_to_consider;
+  vec_free (reference_vars_to_consider);
+  reference_vars_to_consider = NULL;
 }

 /* Deserialize the ipa info for lto.  */

  parent reply	other threads:[~2021-02-10 10:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-09  8:00 [Bug ipa/97346] New: " rguenth at gcc dot gnu.org
2020-10-09  8:03 ` [Bug ipa/97346] " rguenth at gcc dot gnu.org
2021-02-08 13:11 ` rguenth at gcc dot gnu.org
2021-02-08 15:02 ` hubicka at gcc dot gnu.org
2021-02-10 10:54 ` rguenth at gcc dot gnu.org [this message]
2021-02-10 10:54 ` rguenth at gcc dot gnu.org
2021-02-10 11:04 ` rguenth at gcc dot gnu.org
2021-02-10 12:47 ` hubicka at ucw dot cz
2021-02-10 12:56 ` rguenth at gcc dot gnu.org
2021-02-14 22:26 ` cvs-commit at gcc dot gnu.org
2021-02-15  7:46 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97346-4-6fGkQqHqnZ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).