From 0150d9a1cd06feebd2e8efa56e364c8f377fb633 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 16 Jul 2018 13:57:32 +0000 Subject: [PATCH] re PR debug/86523 (ICE in gen_member_die, at dwarf2out.c:24933 starting from r262560) 2018-07-16 Richard Biener PR lto/86523 * dwarf2out.c (dwarf2out_register_external_die): Assign DIE parents for function-local FUNCTION_DECL and RESULT_DECL immediately. * g++.dg/lto/pr86523-1_0.C: New testcase. * g++.dg/lto/pr86523-2_0.C: Likewise. From-SVN: r262696 --- gcc/ChangeLog | 6 ++++++ gcc/dwarf2out.c | 2 ++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/lto/pr86523-1_0.C | 21 +++++++++++++++++++++ gcc/testsuite/g++.dg/lto/pr86523-2_0.C | 18 ++++++++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lto/pr86523-1_0.C create mode 100644 gcc/testsuite/g++.dg/lto/pr86523-2_0.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 41ea59b7aef..974168cef0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-07-16 Richard Biener + + PR lto/86523 + * dwarf2out.c (dwarf2out_register_external_die): Assign DIE parents + for function-local FUNCTION_DECL and RESULT_DECL immediately. + 2018-07-16 Martin Liska PR ipa/86529 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ba5c63eaf0b..1e33cf07f09 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -5959,7 +5959,9 @@ dwarf2out_register_external_die (tree decl, const char *sym, imports the original CUs. */ parent = comp_unit_die (); else if (TREE_CODE (ctx) == FUNCTION_DECL + && TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != PARM_DECL + && TREE_CODE (decl) != RESULT_DECL && TREE_CODE (decl) != BLOCK) /* Leave function local entities parent determination to when we process scope vars. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a4053c9b127..57c59974259 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-07-16 Richard Biener + + PR lto/86523 + * g++.dg/lto/pr86523-1_0.C: New testcase. + * g++.dg/lto/pr86523-2_0.C: Likewise. + 2018-07-16 Martin Liska PR ipa/86529 diff --git a/gcc/testsuite/g++.dg/lto/pr86523-1_0.C b/gcc/testsuite/g++.dg/lto/pr86523-1_0.C new file mode 100644 index 00000000000..3f75cdd9d27 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr86523-1_0.C @@ -0,0 +1,21 @@ +// { dg-lto-do link } +// { dg-lto-options {{-O2 -flto -g -shared}} } +namespace { + class a typedef b; + class a {}; +} // namespace +class c { + struct C { + b d; + }; + C e() const; +}; +c::C c::e() const { + C g; + struct h { + C g; + h(C *) {} + } f(&g); + return g; +} + diff --git a/gcc/testsuite/g++.dg/lto/pr86523-2_0.C b/gcc/testsuite/g++.dg/lto/pr86523-2_0.C new file mode 100644 index 00000000000..f156230827e --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr86523-2_0.C @@ -0,0 +1,18 @@ +// { dg-lto-do link } +// { dg-lto-options {{-O2 -flto -g -shared}} } +class a typedef b; +class a {}; +class c { + struct C { + b d; + }; + C e() const; +}; +c::C c::e() const { + C g; + struct h { + C g; + h(C *) {} + } f(&g); + return g; +} -- 2.30.2