public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dodji at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/45088] pointer type information lost in debuginfo Date: Thu, 11 Nov 2010 15:37:00 -0000 [thread overview] Message-ID: <bug-45088-4-FZkjRoqs2B@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-45088-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45088 Dodji Seketeli <dodji at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2010.11.11 15:37:04 CC|dodji at gcc dot gnu.org | AssignedTo|unassigned at gcc dot |dodji at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #5 from Dodji Seketeli <dodji at gcc dot gnu.org> 2010-11-11 15:37:04 UTC --- Following the (IMHO correect) analysis of Jakub, an interesting question would be: Why is the type of *c1 a typedef variant of "A" instead of being just "A"? It's actually the "self reference type" of A. In struct A, the standard asks to inject the name A into the struct A itself, so that looking up A::A or C::A succeeds. G++ creates a special typedef of A (named self reference type in G++ speak) and injects that typedef into A. So from inside struct C, when considering "A *c1", the lookup of A returns the self reference type of A. I think after the lookup succeeds, G++ should retain A as the type of *c1; not the self reference. Otherwise that confuses the debug info emitter as this bug suggests. I am about to test the patch below that hopefully does what I would want. It's actually the second hunk that fixes this case because it does what I am saying for the simple-type-specifier production. The first hunk is something I noticed while looking at this issue. The initial code in check_elaborated_type_specifier actually tries to do what I am saying (for the elaborated-type-specifier production) but I believe it fails in doing so, probably because the way self references are represented has changed since the code was written. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index fb5ca7f..feba130 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10902,7 +10902,7 @@ check_elaborated_type_specifier (enum tag_types tag_code, name lookup will find the TYPE_DECL for the implicit "S::S" typedef. Adjust for that here. */ if (DECL_SELF_REFERENCE_P (decl)) - decl = TYPE_NAME (TREE_TYPE (decl)); + decl = TYPE_NAME (DECL_ORIGINAL_TYPE (decl)); type = TREE_TYPE (decl); diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 6a9e4d7..d70c621 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -12791,6 +12791,11 @@ cp_parser_simple_type_specifier (cp_parser* parser, /* Otherwise, look for a type-name. */ else type = cp_parser_type_name (parser); + + if (type && TREE_CODE (type) == TYPE_DECL + && DECL_SELF_REFERENCE_P (type)) + type = TYPE_NAME (DECL_ORIGINAL_TYPE (type)); + /* Keep track of all name-lookups performed in class scopes. */ if (type && !global_p
next prev parent reply other threads:[~2010-11-11 15:37 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-45088-4@http.gcc.gnu.org/bugzilla/> 2010-09-27 18:21 ` uweigand at gcc dot gnu.org 2010-09-27 18:34 ` redi at gcc dot gnu.org 2010-09-27 18:34 ` uweigand at gcc dot gnu.org 2010-11-11 15:37 ` dodji at gcc dot gnu.org [this message] 2010-11-11 15:43 ` dodji at gcc dot gnu.org 2010-11-12 12:19 ` dodji at gcc dot gnu.org 2010-12-17 10:39 ` dodji at gcc dot gnu.org 2011-03-15 10:21 ` dodji at gcc dot gnu.org 2012-04-19 8:11 ` pluto at agmk dot net 2012-04-19 19:09 ` jason at gcc dot gnu.org 2010-07-26 19:25 [Bug debug/45088] New: " tromey at gcc dot gnu dot org 2010-07-27 8:29 ` [Bug debug/45088] " jakub at gcc dot gnu dot 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-45088-4-FZkjRoqs2B@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: linkBe 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).