public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/47939] Missing DW_TAG_typedef for qualified types
Date: Tue, 01 Mar 2011 17:01:00 -0000 [thread overview]
Message-ID: <bug-47939-4-EDine0e974@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47939-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47939
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-01 17:01:38 UTC ---
(In reply to comment #6)
> 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.
I see. There is an alternative way to stripping qualifiers - build
an unqualified variant like with
Index: gcc/c-decl.c
===================================================================
--- gcc/c-decl.c (revision 170594)
+++ gcc/c-decl.c (working copy)
@@ -5038,8 +5038,8 @@ grokdeclarator (const struct c_declarato
error_at (loc, "conflicting named address spaces (%s vs %s)",
c_addr_space_name (as1), c_addr_space_name (as2));
- if (!flag_gen_aux_info && (TYPE_QUALS (element_type)))
- type = TYPE_MAIN_VARIANT (type);
+ if (TYPE_QUALS (element_type))
+ type = c_build_qualified_type (type, 0);
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
| (volatilep ? TYPE_QUAL_VOLATILE : 0)
or alternatively using build_qualified_type directly to not strip
qualifiers recursively at this point. That would preserve the
type-names but also introduce a unqualified variants with that name
if it doesn't exist already. To avoid the latter in c_build_qualified_type
we could pass TYPE_MAIN_VARIANT to the build_qualified_type calls.
I don't know if I'm the correct person to try fixing this (I'm certainly
new to this part of the code), but at least the flag_gen_aux_info
checking looks suspicious and should be removed.
next prev parent reply other threads:[~2011-03-01 17:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-01 9:36 [Bug debug/47939] New: " rguenth at gcc dot gnu.org
2011-03-01 14:11 ` [Bug c/47939] " rguenth at gcc dot gnu.org
2011-03-01 14:31 ` rguenth at gcc dot gnu.org
2011-03-01 14:36 ` rguenth at gcc dot gnu.org
2011-03-01 14:49 ` rguenth at gcc dot gnu.org
2011-03-01 15:42 ` rguenth at gcc dot gnu.org
2011-03-01 16:52 ` joseph at codesourcery dot com
2011-03-01 17:01 ` rguenth at gcc dot gnu.org [this message]
2011-03-02 13:12 ` rguenth at gcc dot gnu.org
2011-03-21 15:54 ` rguenth at gcc dot gnu.org
2011-03-22 12:07 ` rguenth at gcc dot gnu.org
2011-04-15 20:18 ` rguenth at gcc dot gnu.org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-47939-4-EDine0e974@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).