This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/68162] [5/6 Regression] Incompatible pointer type using a typedef
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 05 Nov 2015 16:34:56 +0000
- Subject: [Bug c/68162] [5/6 Regression] Incompatible pointer type using a typedef
- Auto-submitted: auto-generated
- References: <bug-68162-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68162
--- Comment #8 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
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.