From 3154f40272f24aea6acae96fe48dadb5aaed6e27 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 7 Nov 2018 08:06:57 +0000 Subject: [PATCH] 2018-11-07 Richard Biener PR lto/87906 * tree-streamer-in.c (lto_input_ts_block_tree_pointers): Fixup BLOCK_ABSTRACT_ORIGIN to be the ultimate origin. * g++.dg/lto/pr87906_0.C: New testcase. * g++.dg/lto/pr87906_1.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@265861 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/lto/pr87906_0.C | 35 +++++++++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/lto/pr87906_1.C | 23 +++++++++++++++++++++++ gcc/tree-streamer-in.c | 6 ++++++ 5 files changed, 76 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lto/pr87906_0.C create mode 100644 gcc/testsuite/g++.dg/lto/pr87906_1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1fde63c79c..a34bf51e7bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-07 Richard Biener + + PR lto/87906 + * tree-streamer-in.c (lto_input_ts_block_tree_pointers): Fixup + BLOCK_ABSTRACT_ORIGIN to be the ultimate origin. + 2018-11-07 Alexandre Oliva PR rtl-optimization/87874 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 66a09d6895e..5b07259db9e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-11-07 Richard Biener + + PR lto/87906 + * g++.dg/lto/pr87906_0.C: New testcase. + * g++.dg/lto/pr87906_1.C: Likewise. + 2018-11-07 Alexandre Oliva PR rtl-optimization/87874 diff --git a/gcc/testsuite/g++.dg/lto/pr87906_0.C b/gcc/testsuite/g++.dg/lto/pr87906_0.C new file mode 100644 index 00000000000..08e7ed3ba07 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr87906_0.C @@ -0,0 +1,35 @@ +// { dg-lto-do link } +// { dg-lto-options { { -O -fPIC -flto } } } +// { dg-extra-ld-options "-shared -nostdlib" } + +namespace com { +namespace sun { +namespace star {} +} // namespace sun +} // namespace com +namespace a = com::sun::star; +namespace com { +namespace sun { +namespace star { +namespace uno { +class a { +public: + ~a(); +}; + +class b { +public: + ~b(); + a c; +}; +class c { + b e; +}; +class RuntimeException : b {}; +} // namespace uno +} // namespace star +} // namespace sun +} // namespace com +template void d(int) { throw a::uno::RuntimeException(); } +int f; +void g() { d(f); } diff --git a/gcc/testsuite/g++.dg/lto/pr87906_1.C b/gcc/testsuite/g++.dg/lto/pr87906_1.C new file mode 100644 index 00000000000..ee5849fd604 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr87906_1.C @@ -0,0 +1,23 @@ +namespace com { +namespace sun { +namespace star { +namespace uno { +class a { +public: + ~a(); +}; +class b { +public: +~b(); + a c; +}; +class RuntimeException : b {}; +} // namespace uno +class C : uno::RuntimeException {}; +} // namespace star +} // namespace sun +} // namespace com +using com::sun::star::C; +using com::sun::star::uno::RuntimeException; +void d() { throw RuntimeException(); } +void e() { C(); } diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c index f1e824421f0..a1e67d624d8 100644 --- a/gcc/tree-streamer-in.c +++ b/gcc/tree-streamer-in.c @@ -914,6 +914,12 @@ lto_input_ts_block_tree_pointers (struct lto_input_block *ib, BLOCK_SUPERCONTEXT (expr) = stream_read_tree (ib, data_in); BLOCK_ABSTRACT_ORIGIN (expr) = stream_read_tree (ib, data_in); + /* We may end up prevailing a decl with DECL_ORIGIN (t) != t here + which breaks the invariant that BLOCK_ABSTRACT_ORIGIN is the + ultimate origin. Fixup here. + ??? This should get fixed with moving to DIE references. */ + if (DECL_P (BLOCK_ORIGIN (expr))) + BLOCK_ABSTRACT_ORIGIN (expr) = DECL_ORIGIN (BLOCK_ABSTRACT_ORIGIN (expr)); /* Do not stream BLOCK_NONLOCALIZED_VARS. We cannot handle debug information for early inlined BLOCKs so drop it on the floor instead of ICEing in dwarf2out.c. */ -- 2.11.4.GIT