https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90914

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Similar to unused type pruning we have to preserve externs local to functions
since they'll be regenerated otherwise.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 272545)
+++ gcc/dwarf2out.c     (working copy)
@@ -29418,6 +29418,10 @@ prune_unused_types_walk (dw_die_ref die)
          if (die->die_perennial_p)
            break;

+         for (c = die->die_parent; c; c = c->die_parent)
+           if (c->die_tag == DW_TAG_subprogram)
+             break;
+
          /* premark_used_variables marks external variables --- don't mark
             them here.  */
          if (get_AT (die, DW_AT_external))

Reply via email to