* Fix PR lto/62026 on mainline
@ 2014-10-15 17:02 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2014-10-15 17:02 UTC (permalink / raw)
To: gcc-patches
Hi,
this is mainline version of the fix for thunk creation I comitted to gcc-4.9 branch week ago.
Bootstrapped/regtested x86_64-linux, comitted.
Honza
PR lto/62026
* lto/pr62026.C: New testcase.
* cgraphclones.c (duplicate_thunk_for_node): Get body to have args
to duplicate.
* lto-streamer-out.c (lto_output): Handle correctly thunks that was born
at WPA time.
Index: testsuite/g++.dg/lto/pr62026.C
===================================================================
--- testsuite/g++.dg/lto/pr62026.C (revision 0)
+++ testsuite/g++.dg/lto/pr62026.C (revision 0)
@@ -0,0 +1,22 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -O3 -r -nostdlib}} }
+class C;
+class F {
+ virtual C m_fn1();
+};
+class C {
+ public:
+ virtual int *m_fn3(int);
+};
+class G : F, C {
+ int offsets;
+ int *m_fn3(int);
+};
+C *a;
+int *G::m_fn3(int) {
+ if (offsets) return 0;
+}
+
+void fn1() {
+ for (;;) a->m_fn3(0);
+}
Index: cgraphclones.c
===================================================================
--- cgraphclones.c (revision 216272)
+++ cgraphclones.c (working copy)
@@ -295,6 +295,9 @@ duplicate_thunk_for_node (cgraph_node *t
if (thunk_of->thunk.thunk_p)
node = duplicate_thunk_for_node (thunk_of, node);
+ if (!DECL_ARGUMENTS (thunk->decl))
+ thunk->get_body ();
+
cgraph_edge *cs;
for (cs = node->callers; cs; cs = cs->next_caller)
if (cs->caller->thunk.thunk_p
Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c (revision 216272)
+++ lto-streamer-out.c (working copy)
@@ -2249,7 +2249,10 @@ lto_output (void)
#endif
decl_state = lto_new_out_decl_state ();
lto_push_out_decl_state (decl_state);
- if (gimple_has_body_p (node->decl) || !flag_wpa)
+ if (gimple_has_body_p (node->decl) || !flag_wpa
+ /* Thunks have no body but they may be synthetized
+ at WPA time. */
+ || DECL_ARGUMENTS (node->decl))
output_function (node);
else
copy_function_or_variable (node);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-10-15 17:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-15 17:02 Fix PR lto/62026 on mainline Jan Hubicka
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).