https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81135
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-06-20 CC| |aldyh at gcc dot gnu.org, | |jason at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. Note that technically for extern int j; extern int i; extern int bar (int); extern int foo (int); int main () { return foo (1) + i; } we are still missing debuginfo for 'foo'. If the module containing the implementation was not built with -g then debugging experience in this module is worse than necessary. Note that 'foo' _is_ used here still neither GCC 5 nor GCC 6 create a DIE for 'foo' but both generate one for 'i'. GCC 6 now generates a DIE for 'j' where GCC 5 didn't. No compiler generates a DIE for 'bar'. Same for GCC 7 + trunk. I think we should have a mode where we generate debuginfo for all of the extern declarations, used or not, and we should have a way to prune unused extern decl DIEs. Which means we should emit a DIE for 'foo' in all cases (which will bloat info). Otherwise why emit one for 'i' (maybe have a mode to drop all extern DIEs which may be refered to via the symtab).