public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Clean up dangling pointers in cgraph_edge (PR ipa/89330).
@ 2019-07-30  7:28 Martin Liška
  2019-07-30  8:41 ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Liška @ 2019-07-30  7:28 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andreas Schwab

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

Hi.

We have to clean up dangling pointers before we call ggc_free for a cgraph_edge.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
And it survives --enable-checking=release bootstrap on x86_64-linux-gnu.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-07-30  Martin Liska  <mliska@suse.cz>

	PR ipa/89330
	* cgraph.c (symbol_table::free_edge): Memset 0 to cgraph_edge
	before we call ggc_free.
---
 gcc/cgraph.c | 2 ++
 1 file changed, 2 insertions(+)



[-- Attachment #2: 0001-Clean-up-dangling-pointers-in-cgraph_edge-PR-ipa-893.patch --]
[-- Type: text/x-patch, Size: 439 bytes --]

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 81250acb70c..372974f12df 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1008,6 +1008,8 @@ symbol_table::free_edge (cgraph_edge *e)
   if (e->m_summary_id != -1)
     edge_released_summary_ids.safe_push (e->m_summary_id);
 
+  /* Clear out the edge so we do not dangle pointers.  */
+  memset (e, 0, sizeof (*e));
   if (e->indirect_info)
     ggc_free (e->indirect_info);
   ggc_free (e);


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-08-08 21:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30  7:28 [PATCH] Clean up dangling pointers in cgraph_edge (PR ipa/89330) Martin Liška
2019-07-30  8:41 ` Richard Biener
2019-07-30  8:49   ` Martin Liška
2019-07-30 13:39     ` [PATCH v2] Use edge->indirect_unknown_callee in cgraph_edge::make_direct " Martin Liška
2019-07-30 14:54       ` Martin Liška
2019-08-07 22:21       ` Jeff Law
2019-08-08  8:14         ` Martin Liška
2019-08-08 22:06           ` Jeff Law

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).