On Wed, Jul 12, 2017 at 5:42 PM, Franklin “Snaipe” Mathieu
<sna...@arista.com> wrote:
> From: Franklin “Snaipe” Mathieu <sna...@diacritic.io>
>
> Hello GCC folks,
>
> This patch series addresses PR 81135 [1].
>
> * patch 1/3 is for trunk (built/tested on trunk@250093).
> * patch 2/3 is the gcc7 backport (built/tested on gcc-7-branch@249680).
> * patch 3/3 is the gcc6 backport (built/tested on gcc-6-branch@249671).
>
> [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81135

Doing this from late_global_decl is bogus from a conceptual point.  It should
be instead done from dwarf2out_early_finish where we also prune unused
types from (prune_unused_types).  I'd be more comfortable if you'd integrate
removing unused global declarations into that function given it already handles
uses in attributes and the like.

The other possibility is to address this from the FE side and not call
early_global_decl
on mere declarations but only after parsing (when TREE_USED is
properly set) walk
them again and register them at that point.

Richard.

> Kind Regards,
>
> --
> Franklin "Snaipe" Mathieu
> Arista Networks, Ltd
>

Reply via email to