https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78265
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-11-09 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. We are indeed erring more and more on the side of emit-debug-info for whatever is referenced in the source. In this case debug info for 'i' is requested via #0 dwarf2out_early_global_decl (decl=<var_decl 0x2aaaaaad7b40 i>) at /space/rguenther/src/gcc-git/gcc/dwarf2out.c:25232 #1 0x0000000000ffa9e5 in rest_of_decl_compilation ( decl=<var_decl 0x2aaaaaad7b40 i>, top_level=1, at_end=0) at /space/rguenther/src/gcc-git/gcc/passes.c:320 #2 0x00000000007ee13e in make_rtl_for_nonlocal_decl ( decl=<var_decl 0x2aaaaaad7b40 i>, init=<tree 0x0>, asmspec=0x0) at /space/rguenther/src/gcc-git/gcc/cp/decl.c:6433 #3 0x00000000007f0d73 in cp_finish_decl (decl=<var_decl 0x2aaaaaad7b40 i>, init=<tree 0x0>, init_const_expr_p=false, asmspec_tree=<tree 0x0>, flags=1) at /space/rguenther/src/gcc-git/gcc/cp/decl.c:7067 and we never prune debug info for decls (only for "unused" types). OTOH I'm not a strong believer in first generating something and later pruning it again. Same happens with the C frontend.