diff mbox series

[v2] Use edge->indirect_unknown_callee in cgraph_edge::make_direct (PR ipa/89330).

Message ID 1b2b43ee-bd5f-2c2f-88ee-20fb558460f6@suse.cz
State New
Headers show
Series [v2] Use edge->indirect_unknown_callee in cgraph_edge::make_direct (PR ipa/89330). | expand

Commit Message

Martin Liška July 30, 2019, 1:37 p.m. UTC
Hi.

Thanks to Martin I was able to prepare a proper fix. The issue is that
cgraph_edge::resolve_speculation can delete this pointer (yes, it's
super nasty) and so that the caller can't use this->something
right after the function returns.

For the long term, I'll rework the ::resolve_speculation function.

The patch survives --enable-checking bootstrap on x86_64-linux-gnu.

Ready to be installed after proper testing?
Thanks,
Martin

Comments

Martin Liška July 30, 2019, 2:50 p.m. UTC | #1
On 7/30/19 3:37 PM, Martin Liška wrote:
> Hi.
> 
> Thanks to Martin I was able to prepare a proper fix. The issue is that
> cgraph_edge::resolve_speculation can delete this pointer (yes, it's
> super nasty) and so that the caller can't use this->something
> right after the function returns.
> 
> For the long term, I'll rework the ::resolve_speculation function.
> 
> The patch survives --enable-checking bootstrap on x86_64-linux-gnu.
> 
> Ready to be installed after proper testing?
> Thanks,
> Martin
> 

Honza approved me the patch offline.

Martin
Jeff Law Aug. 7, 2019, 10:08 p.m. UTC | #2
On 7/30/19 7:37 AM, Martin Liška wrote:
> Hi.
> 
> Thanks to Martin I was able to prepare a proper fix. The issue is that
> cgraph_edge::resolve_speculation can delete this pointer (yes, it's
> super nasty) and so that the caller can't use this->something
> right after the function returns.
> 
> For the long term, I'll rework the ::resolve_speculation function.
> 
> The patch survives --enable-checking bootstrap on x86_64-linux-gnu.
> 
> Ready to be installed after proper testing?
> Thanks,
> Martin
> 
Would this possibly be the cause of this error building the kernel:


> /opt/notnfs/law/jenkins/workspace/x86_64-linux-gnu/linux/lib/iov_iter.c: In function 'memcpy_to_page':
> /opt/notnfs/law/jenkins/workspace/x86_64-linux-gnu/linux/lib/iov_iter.c:1718:1: internal compiler error: in gt_ggc_mx_symtab_node, at gtype-desc.c:1382
>  1718 | EXPORT_SYMBOL(iov_iter_for_each_range);
>       | ^~~~~~~~~~~~~
> 0x66537c gt_ggc_mx_symtab_node(void*)
> 	/opt/notnfs/law/jenkins/workspace/x86_64-linux-gnu/obj/gcc/gcc/gtype-desc.c:1382
>   CC      fs/super.o
> 0xcafbcd gt_ggc_ma_order
> 	./gt-passes.h:31
> 0xcafbcd gt_ggc_ma_order
> 	./gt-passes.h:26
> 0xac0555 ggc_mark_root_tab
> 	../../../gcc/gcc/ggc-common.c:77
> 0xac075c ggc_mark_roots()
> 	../../../gcc/gcc/ggc-common.c:94
> 0x8ee485 ggc_collect()
> 	../../../gcc/gcc/ggc-page.c:2201
> Please submit a full bug report,

Jeff
Martin Liška Aug. 8, 2019, 7:41 a.m. UTC | #3
On 8/8/19 12:08 AM, Jeff Law wrote:
> Would this possibly be the cause of this error building the kernel:

Probably yes. You see the same as H.J.:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91334

Can you please create a pre-processed source with and command line options?
And please tell me how you configure your compiler?

Thanks,
Martin
Jeff Law Aug. 8, 2019, 9:45 p.m. UTC | #4
On 8/8/19 1:41 AM, Martin Liška wrote:
> On 8/8/19 12:08 AM, Jeff Law wrote:
>> Would this possibly be the cause of this error building the kernel:
> 
> Probably yes. You see the same as H.J.:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91334
> 
> Can you please create a pre-processed source with and command line options?
> And please tell me how you configure your compiler?
Ugh.  I was going to do a litle bisection and investigation and, of
course, it's not triggering.   I'm moving a bit between multiple tasks
as a dig out from vacation, but will try to get you something useful as
soon as I can.

jeff
diff mbox series

Patch

From 15873b0ebfca4cf4ce06b49f6ebb798a14414eb2 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Tue, 30 Jul 2019 15:12:52 +0200
Subject: [PATCH] Use edge->indirect_unknown_callee in cgraph_edge::make_direct
 (PR ipa/89330).

gcc/ChangeLog:

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

	PR ipa/89330
	* cgraph.c (cgraph_edge::make_direct): Use
	edge->indirect_unknown_callee as edge->resolve_speculation can
	deallocate edge which is this pointer.
---
 gcc/cgraph.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 81250acb70c..8dbe705af68 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1215,7 +1215,7 @@  cgraph_edge::make_direct (cgraph_node *callee)
       edge = edge->resolve_speculation (callee->decl);
 
       /* On successful speculation just return the pre existing direct edge.  */
-      if (!indirect_unknown_callee)
+      if (!edge->indirect_unknown_callee)
         return edge;
     }
 
-- 
2.22.0