https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68162
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to jos...@codesourcery.com from comment #8) > I don't know what DWARF semantics are meant to be, but the language > semantics are definitely that in C array types are always unqualified, > whereas in C++, while the qualifiers still apply to the element type, the > array type is also considered qualified for most/all purposes. > > > When I just not do that main variant punning here I get > > > > <1><60>: Abbrev Number: 10 (DW_TAG_variable) > > <61> DW_AT_name : (indirect string, offset: 0x7b): harry > > <65> DW_AT_decl_file : 1 > > <66> DW_AT_decl_line : 5 > > <67> DW_AT_type : <0x75> > > ... > > <1><75>: Abbrev Number: 6 (DW_TAG_const_type) > > <76> DW_AT_type : <0x49> > > <1><49>: Abbrev Number: 7 (DW_TAG_array_type) > > <4a> DW_AT_type : <0x39> > > <4e> DW_AT_sibling : <0x59> > > <1><39>: Abbrev Number: 5 (DW_TAG_typedef) > > <3a> DW_AT_name : (indirect string, offset: 0x0): Harry_t > > <3e> DW_AT_decl_file : 1 > > <3f> DW_AT_decl_line : 4 > > <40> DW_AT_type : <0x44> > > > > instead. Not sure about that "extra" const qualifier on the array type > > though. > > Does the extra qualifier come from decl_quals extracting qualifiers from a > decl to combine with those for the type? My guess would be that such code > for extracting qualifiers is a legacy of when, a long time ago (before > <https://gcc.gnu.org/ml/gcc-patches/2001-06/msg00498.html>), the types of > decls in the C and C++ front ends did not include top-level qualifiers, > and so should be obsolete now. I have no idea and my dives into dwarf2out.c have not been volutary for now ;) Cleaning it up and removing cruft is always welcome.