diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-10-15 19:01:08 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-10-15 17:01:08 +0000 |
commit | 48fb6d4090508e8dde8aaa95b366c2489f62950b (patch) | |
tree | 1f015af4afa8c3718025ac862a9f9c29c76b5e0f /gcc | |
parent | d5ffd10bc2afc1da7e18e63721a5056fcc420633 (diff) | |
download | gcc-48fb6d4090508e8dde8aaa95b366c2489f62950b.zip gcc-48fb6d4090508e8dde8aaa95b366c2489f62950b.tar.gz gcc-48fb6d4090508e8dde8aaa95b366c2489f62950b.tar.bz2 |
re PR lto/62026 (Crash in lto_get_decl_name_mapping)
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.
From-SVN: r216278
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cgraphclones.c | 3 | ||||
-rw-r--r-- | gcc/lto-streamer-out.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lto/pr62026.C | 22 |
5 files changed, 42 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8eb654c..5ba303d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-10-15 Jan Hubicka <hubicka@ucw.cz> + + PR lto/62026 + * 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. + 2014-10-15 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/63448 diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index c487c13..71b9269 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -295,6 +295,9 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node) 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 diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index dad751b..6d1384f 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c3e540..471cd77 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-10-15 Jan Hubicka <hubicka@ucw.cz> + + PR lto/62026 + * lto/pr62026.C: New testcase. + 2014-10-15 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/63448 diff --git a/gcc/testsuite/g++.dg/lto/pr62026.C b/gcc/testsuite/g++.dg/lto/pr62026.C new file mode 100644 index 0000000..63766a8 --- /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); +} |