re PR debug/90914 (ICE in schedule_generic_params_dies_gen, at dwarf2out.c:27153)
authorRichard Biener <rguenther@suse.de>
Fri, 21 Jun 2019 13:56:54 +0000 (13:56 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 21 Jun 2019 13:56:54 +0000 (13:56 +0000)
2019-06-21  Richard Biener  <rguenther@suse.de>

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

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/pr90914.C [new file with mode: 0644]

index 0c75a0f687ecb5b8833b05d64eb9efacd046e1aa..10287816836726753a6fbbe821f48887d31cb951 100644 (file)
@@ -1,3 +1,9 @@
+2019-06-21  Richard Biener  <rguenther@suse.de>
+
+       PR debug/90914
+       * dwarf2out.c (prune_unused_types_walk): Always consider
+       function-local extern declarations as used.
+
 2019-06-21  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/90913
index 960d9be70d0df4d6e11b0037b7e353c26520daf9..6a85c12fb761390200580c47a4aaac738a716484 100644 (file)
@@ -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 */
 
index 8181bcd752eeb5811257a2a0460996077a9d6711..21eef285afcec37218fd07cde1cd09a98129dc72 100644 (file)
@@ -1,3 +1,8 @@
+2019-06-21  Richard Biener  <rguenther@suse.de>
+
+       PR debug/90914
+       * g++.dg/debug/pr90914.C: New testcase.
+
 2019-06-21  Richard Biener  <rguenther@suse.de>
 
        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 (file)
index 0000000..3681d58
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-additional-options "-feliminate-unused-debug-symbols" }
+
+template <class> class A;
+void f ()
+{
+  extern A <double> b;
+}