https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14167
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |WAITING --- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- For the original testcase we emit nothing of Class1 or Class2 into debuginfo which just has <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit) <c> DW_AT_producer : (indirect string, offset: 0x0): GNU C++14 9.2.0 -m tune=generic -march=x86-64 -g <10> DW_AT_language : 4 (C++) <11> DW_AT_name : t.C <15> DW_AT_comp_dir : (indirect string, offset: 0x30): /tmp <19> DW_AT_stmt_list : 0x0 <1><1d>: Abbrev Number: 2 (DW_TAG_base_type) <1e> DW_AT_byte_size : 4 <1f> DW_AT_encoding : 5 (signed) <20> DW_AT_name : int <1><24>: Abbrev Number: 0 even with GCC 4.8 ... (4.3.6 still has var1). For the testcase in comment#4 we get nothing as well since even without optimization the C++ frontend propagates the constant and the symtab code removes the unused variables before we even get to debug info creation. That is btw the issue we get nothing for the original testcase as well. So whether the bug is fixed remains unknown, but the testcases clearly do not show the original issue?