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: Fri, 09 Oct 2020 08:03:27 +0000	[thread overview]
Message-ID: <bug-97346-4-5yyDO9GGEE@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 #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
At least

diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 4a6c011c525..6df4be09471 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -1114,7 +1113,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.  */

is maybe obvious.  Then there's

diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 4a6c011c525..f0555929340 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -1056,6 +1056,7 @@ ipa_reference_write_optimization_summary (void)
   auto_bitmap ltrans_statics;
   int i;

+  gcc_assert (!reference_vars_to_consider);
   vec_alloc (reference_vars_to_consider, ipa_reference_vars_uids);
   reference_vars_to_consider->safe_grow (ipa_reference_vars_uids, true);


that will likely trip because of the ipa_init allocation.  And

diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 4a6c011c525..93b2b677a76 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -964,8 +964,10 @@ propagate (void)
     }

   if (dump_file)
-    vec_free (reference_vars_to_consider);
-  reference_vars_to_consider = NULL;
+    {
+      vec_free (reference_vars_to_consider);
+      reference_vars_to_consider = NULL;
+    }
   return remove_p ? TODO_remove_functions : 0;
 }


anyway, it all looks like a mess ;)

  reply	other threads:[~2020-10-09  8:03 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 ` rguenth at gcc dot gnu.org [this message]
2021-02-08 13:11 ` [Bug ipa/97346] " 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
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-5yyDO9GGEE@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).