https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110439
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-06-28 Ever confirmed|0 |1 --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- it works fine with foo const attr_foo; where we generate <1><1e>: Abbrev Number: 3 (DW_TAG_typedef) <1f> DW_AT_name : foo <23> DW_AT_decl_file : 1 <24> DW_AT_decl_line : 1 <25> DW_AT_decl_column : 13 <26> DW_AT_type : <0x2f> <1><2a>: Abbrev Number: 4 (DW_TAG_const_type) <2b> DW_AT_type : <0x1e> <1><36>: Abbrev Number: 1 (DW_TAG_variable) <37> DW_AT_name : (indirect string, offset: 0xa): attr_foo <3b> DW_AT_decl_file : 1 <3b> DW_AT_decl_line : 2 <3c> DW_AT_decl_column : 11 <3d> DW_AT_type : <0x2a> <41> DW_AT_external : 1 <41> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr: 0) to GCC the attribute generates a similar type variant but there's no way to emit the "qualification" in dwarf but it looks like for consistency we should then fall back to the typedef DIE, not the base type DIE. Confirmed.