From a1a0e08d63b3b1d68e2e270f4c62b8d4c4ae2640 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 10 Oct 2018 22:54:04 +0000 Subject: [PATCH] re PR middle-end/87574 (ICE in add_data_member_location_attribute at gcc/gcc/dwarf2out.c:19226 since r264943) PR middle-end/87574 * cgraphunit.c (cgraph_node::expand_thunk): Force DECL_IGNORED_P on the thunk when expanding to GIMPLE. From-SVN: r265028 --- gcc/ChangeLog | 6 +++++ gcc/cgraphunit.c | 6 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/other/pr87574.C | 33 ++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 gcc/testsuite/g++.dg/other/pr87574.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 81171bedf33..3ee20df669c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-10 Eric Botcazou + + PR middle-end/87574 + * cgraphunit.c (cgraph_node::expand_thunk): Force DECL_IGNORED_P on + the thunk when expanding to GIMPLE. + 2018-10-10 Bernd Edlinger * varasm.c (mergeable_string_section): Don't try to move zero-length diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 5176cd1f1ff..cb8495417b5 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1862,6 +1862,12 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) DECL_ARGUMENTS. In this case force_gimple_thunk is true. */ if (in_lto_p && !force_gimple_thunk) get_untransformed_body (); + + /* We need to force DECL_IGNORED_P when the thunk is created + after early debug was run. */ + if (force_gimple_thunk) + DECL_IGNORED_P (thunk_fndecl) = 1; + a = DECL_ARGUMENTS (thunk_fndecl); current_function_decl = thunk_fndecl; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5c751749491..05dab1f46a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-10-10 Eric Botcazou + + * g++.dg/other/pr87574.C: New test. + 2018-10-10 Marek Polacek PR c++/87567 - constexpr rejects call to non-constexpr function. diff --git a/gcc/testsuite/g++.dg/other/pr87574.C b/gcc/testsuite/g++.dg/other/pr87574.C new file mode 100644 index 00000000000..190e3865505 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/pr87574.C @@ -0,0 +1,33 @@ +// PR middle-end/87574 +// Testcase by David Binderman + +// { dg-do compile } +// { dg-options "-O2 -g -Wno-return-type" } + +class a { +public: + virtual ~a(); +}; +class c { +public: + enum j {}; + virtual j d() = 0; +}; +class e : a, c { + j d(); +}; +class f; +class g { +public: + static g *h(); + f *i(); +}; +class f { +public: + template b *l(int); +}; +c::j e::d() {} +void m() { + for (int k;;) + g::h()->i()->l(k)->d(); +} -- 2.30.2