From: Richard Biener Date: Fri, 21 Jun 2019 13:56:54 +0000 (+0000) Subject: re PR debug/90914 (ICE in schedule_generic_params_dies_gen, at dwarf2out.c:27153) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=050e182a757bdf227a7e2425f06f9e2fd4dff8cb;p=gcc.git re PR debug/90914 (ICE in schedule_generic_params_dies_gen, at dwarf2out.c:27153) 2019-06-21 Richard Biener PR debug/90914 * dwarf2out.c (prune_unused_types_walk): Always consider function-local extern declarations as used. * g++.dg/debug/pr90914.C: New testcase. From-SVN: r272547 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c75a0f687e..10287816836 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-06-21 Richard Biener + + PR debug/90914 + * dwarf2out.c (prune_unused_types_walk): Always consider + function-local extern declarations as used. + 2019-06-21 Richard Biener PR tree-optimization/90913 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 960d9be70d0..6a85c12fb76 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -29419,9 +29419,16 @@ prune_unused_types_walk (dw_die_ref die) break; /* premark_used_variables marks external variables --- don't mark - them here. */ + them here. But function-local externals are always considered + used. */ if (get_AT (die, DW_AT_external)) - return; + { + for (c = die->die_parent; c; c = c->die_parent) + if (c->die_tag == DW_TAG_subprogram) + break; + if (!c) + return; + } } /* FALLTHROUGH */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8181bcd752e..21eef285afc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-06-21 Richard Biener + + PR debug/90914 + * g++.dg/debug/pr90914.C: New testcase. + 2019-06-21 Richard Biener PR tree-optimization/90913 diff --git a/gcc/testsuite/g++.dg/debug/pr90914.C b/gcc/testsuite/g++.dg/debug/pr90914.C new file mode 100644 index 00000000000..3681d58cdf3 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/pr90914.C @@ -0,0 +1,8 @@ +// { dg-do compile } +// { dg-additional-options "-feliminate-unused-debug-symbols" } + +template class A; +void f () +{ + extern A b; +}