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

            Bug ID: 81135
           Summary: Extra debug info generated for unused extern
                    declarations
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peadar at arista dot com
  Target Milestone: ---

Created attachment 41589
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41589&action=edit
Contains trivial test program, and output from gcc-5 and gcc-6 showing old and
new behaviour

This is a follow-up to track the discussion at
https://gcc.gnu.org/ml/gcc-help/2017-06/threads.html#00086

Since version 6.1.0, gcc has produced DW_TAG_variable DIEs for variables
declared as extern, but not otherwise used in the translation unit.

For libraries with large numbers of object files compiled from source
containing a large number of extern declarations, the overhead of this can be
quite significant

I've attached a tarball including the output gcc-6 and gcc-5 from an ubuntu
17.04 system, the former of which exhibits the problem, the latter which does
not. You can see that the `fooUnused` extern declaration has a DW_TAG_variable
with gcc-6, but not gcc-5.

As per the discussion thread, this seems to be fallout from the integration of
the "debug-early" branch, and discussion at
https://gcc.gnu.org/ml/gcc/2015-05/msg00046.html seems to suggest that some
bloating of DWARF data was expected, and that later work would address the
issue.

Bisecting the git mirror on github does show the behaviour being introduced at
https://github.com/gcc-mirror/gcc/commit/3a1c9df , which is where this branch
merged in.

Reply via email to