summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-05 02:37:31 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-05 02:37:31 +0000
commit5ce1c5afa462b69f3d4f1335fd641a3dda472476 (patch)
tree2bc3b7b7e3438bb4d18c86097d66c6621d4a11b3
parenta75922cb2154d455b162ae4b3fe17d4eac406957 (diff)
downloadppe42-gcc-5ce1c5afa462b69f3d4f1335fd641a3dda472476.tar.gz
ppe42-gcc-5ce1c5afa462b69f3d4f1335fd641a3dda472476.zip
PR lto/62026
* g++.dg/lto/pr62026.C: New testcase. * lto-streamer-out.c (lto_output): Handle thunks correctly. * cgraphclones.c (duplicate_thunk_for_node): Get thunk's arguments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@215894 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cgraphclones.c5
-rw-r--r--gcc/lto-streamer-out.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/lto/pr62026.C22
5 files changed, 42 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 805966c39ca..0f9d230ed8b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-10-03 Jan Hubicka <hubicka@ucw.cz>
+
+ PR lto/62026
+ * lto-streamer-out.c (lto_output): Handle thunks correctly.
+ * cgraphclones.c (duplicate_thunk_for_node): Get thunk's arguments.
+
2014-10-03 Jakub Jelinek <jakub@redhat.com>
PR libgomp/61200
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index 9ad76dd518b..e310b1ce801 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -310,6 +310,11 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
if (thunk_of->thunk.thunk_p)
node = duplicate_thunk_for_node (thunk_of, node);
+ /* We need to copy arguments, at LTO these mat not be read from function
+ section. */
+ if (!DECL_ARGUMENTS (thunk->decl))
+ cgraph_get_body (thunk);
+
struct cgraph_edge *cs;
for (cs = node->callers; cs; cs = cs->next_caller)
if (cs->caller->thunk.thunk_p
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index b193d730d75..6b5df1a611c 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2077,7 +2077,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 (node);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e83af88c095..b313230a398 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-03 Jan Hubicka <hubicka@ucw.cz>
+
+ PR lto/62026
+ * g++.dg/lto/pr62026.C: New testcase.
+
2014-10-03 Jakub Jelinek <jakub@redhat.com>
PR libgomp/61200
diff --git a/gcc/testsuite/g++.dg/lto/pr62026.C b/gcc/testsuite/g++.dg/lto/pr62026.C
new file mode 100644
index 00000000000..63766a85b98
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr62026.C
@@ -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);
+}
OpenPOWER on IntegriCloud