This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/47939] Missing DW_TAG_typedef for qualified types
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 1 Mar 2011 16:52:39 +0000
- Subject: [Bug c/47939] Missing DW_TAG_typedef for qualified types
- Auto-submitted: auto-generated
- References: <bug-47939-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47939
--- Comment #6 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-03-01 16:52:37 UTC ---
On Tue, 1 Mar 2011, rguenth at gcc dot gnu.org wrote:
> The patch bootstrapped and tested ok. Removing
>
> if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
> type = TYPE_MAIN_VARIANT (type);
>
> unconditionally breaks gcc.dg/array-quals-2.c (but nothing else).
The point of the logic removing qualifiers here is as described in the
comment
/* Now figure out the structure of the declarator proper.
Descend through it, creating more complex types, until we reach
the declared identifier (or NULL_TREE, in an absolute declarator).
At each stage we maintain an unqualified version of the type
together with any qualifiers that should be applied to it with
c_build_qualified_type; this way, array types including
multidimensional array types are first built up in unqualified
form and then the qualified form is created with
TYPE_MAIN_VARIANT pointing to the unqualified form. */
to ensure consistency in TYPE_MAIN_VARIANT for array types; see
<http://gcc.gnu.org/ml/gcc-patches/2005-01/msg02180.html>.
> Probably a better general approach would be to make c_build_qualified_type
> also take a desired name as argument instead of using TYPE_NAME.
In general it's a desired name for an intermediate type at some level of
array derivation, not for the type being constructed by
c_build_qualified_type. I suppose you could pass both the name and the
particular type that should have that name, or otherwise indicate the
qualifiers and level of array nesting where the name should be used if
possible.
If you have
typedef const int T[1];
T array[2][3];
then "const" is being applied to "int [2][3][1]", and it's the
intermediate type "const int [1]" that you'd like to get the name T.