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/45997] [4.6 Regression] __unknown__ type name for typedef'd int
Date: Mon, 08 Nov 2010 22:39:00 -0000	[thread overview]
Message-ID: <bug-45997-4-Ji7WsNChwZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-45997-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45997

--- Comment #4 from Dodji Seketeli <dodji at gcc dot gnu.org> 2010-11-08 22:39:09 UTC ---
At some point modified_type_die is called for volatile_const_my_int with
is_volatile and is_const_type set to 0, meaning we want to emit the DIE
of the cv-unqualified version of volatile_const_my_int i.e, my_int.

The problem is that the line

  /* See if we already have the appropriately qualified variant of
     this type.  */
  qualified_type
    = get_qualified_type (type,
              ((is_const_type ? TYPE_QUAL_CONST : 0)
               | (is_volatile_type ? TYPE_QUAL_VOLATILE : 0)));

fails to give us the the my_int (cv-unqualified version of
volatile_const_my_int) we want and returns NULL instead. That's because
get_qualified_type doesn't look through typedefs as it must preserve
TYPE_NAMEs (see the comment in get_qualified_type). From this point, I
think we are likely to loose.

So, maybe if we try harder to come up with the cv-unqualified version of
the input type, things will get better?

This patch that (only lightly tested seems) to fix the problem too. What
do you think?

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9bb569b..f639e24 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -12715,6 +12715,19 @@ modified_type_die (tree type, int is_const_type, int
is_volatile_type,
               ((is_const_type ? TYPE_QUAL_CONST : 0)
                | (is_volatile_type ? TYPE_QUAL_VOLATILE : 0)));

+  /* If TYPE is a typedef and we want its cv-unqualified version,
+     get_qualified_type just returns NULL because it doesn't look
+     through typedefs; In that case, let's use the underlying type of
+     the typedef.  */
+  if (qualified_type == NULL
+      && typedef_variant_p (type)
+      && (is_const_type < TYPE_READONLY (type)
+      || is_volatile_type < TYPE_VOLATILE (type)))
+    qualified_type =
+      get_qualified_type (DECL_ORIGINAL_TYPE (TYPE_NAME (type)),
+              ((is_const_type ? TYPE_QUAL_CONST : 0)
+               | (is_volatile_type ? TYPE_QUAL_VOLATILE : 0)));
+
   if (qualified_type == sizetype
       && TYPE_NAME (qualified_type)
       && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL)


  parent reply	other threads:[~2010-11-08 22:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-13  4:48 [Bug debug/45997] New: " dje at google dot com
2010-10-27 23:00 ` [Bug debug/45997] [4.6 Regression] " pinskia at gcc dot gnu.org
2010-11-03 13:21 ` jakub at gcc dot gnu.org
2010-11-03 14:08 ` jakub at gcc dot gnu.org
2010-11-08 22:39 ` dodji at gcc dot gnu.org [this message]
2010-11-12 11:59 ` dodji at gcc dot gnu.org
2010-11-12 12:05 ` dodji at gcc dot gnu.org
2010-12-06 19:34 ` jakub at gcc dot gnu.org
2010-12-06 19:41 ` jakub 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-45997-4-Ji7WsNChwZ@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).