From 67124cb62dd566664aa53183821957fa97b27e54 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 8 Nov 2018 14:57:47 +0000 Subject: [PATCH] re PR middle-end/87916 (ICE in dwarf2out_abstract_function, at dwarf2out.c:22479 since r264943) PR middle-end/87916 * cgraphclones.c (duplicate_thunk_for_node): Also set DECL_IGNORED_P. From-SVN: r265916 --- gcc/ChangeLog | 5 ++++ gcc/cgraphclones.c | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/other/pr87916.C | 45 ++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 gcc/testsuite/g++.dg/other/pr87916.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46efe5d..c83df0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-11-08 Eric Botcazou + + PR middle-end/87916 + * cgraphclones.c (duplicate_thunk_for_node): Also set DECL_IGNORED_P. + 2018-11-08 David Malcolm * cgraph.c: Include "selftest.h". diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c index e17959c..0fbc7a9 100644 --- a/gcc/cgraphclones.c +++ b/gcc/cgraphclones.c @@ -321,6 +321,10 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node) "artificial_thunk"); SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); + /* We need to force DECL_IGNORED_P because the new thunk is created after + early debug was run. */ + DECL_IGNORED_P (new_decl) = 1; + new_thunk = cgraph_node::create (new_decl); set_new_clone_decl_and_node_flags (new_thunk); new_thunk->definition = true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6c36f3..63019e1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-11-08 Eric Botcazou + + * g++.dg/other/pr87916.C: New test. + 2018-11-08 Richard Biener PR tree-optimization/87929 diff --git a/gcc/testsuite/g++.dg/other/pr87916.C b/gcc/testsuite/g++.dg/other/pr87916.C new file mode 100644 index 0000000..5c69478 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr87916.C @@ -0,0 +1,45 @@ +// PR middle-end/87916 +// Testcase by Martin Liška + +// { dg-do compile } +// { dg-options "-O2 -g" } +// { dg-additional-options "-fPIC" { target fpic } } + +struct a { + virtual ~a(); +}; +template class c { +public: + class d { + public: + d(c); + b *operator->(); + }; +}; +int e, f; +class g { +public: + class h { + public: + virtual void j(g &, int &, bool) = 0; + }; + c k(); + int *l(); + int *m(); +}; +int *g::l() try { + for (c::d i(k());;) + i->j(*this, e, true); +} catch (int) { + return 0; +} +int *g::m() try { + for (c::d i(k());;) + i->j(*this, f, false); +} catch (int) { + return 0; +} +struct n : a, g::h { + void o(); + void j(g &, int &, bool) { o(); } +}; -- 2.7.4