Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Wilson <wilson@specifix.com>
To: Gary Funck <gary@intrepid.com>
Cc: gdb@sourceware.org, 'Daniel Jacobowitz' <drow@false.org>
Subject: RE: how to support C type qualifiers applied to arrays?
Date: Mon, 01 Jan 2007 22:16:00 -0000	[thread overview]
Message-ID: <1167689747.2505.17.camel@localhost.localdomain> (raw)
In-Reply-To: <200612141837.kBEIb7Lw024917@intrepid.intrepid.com>

On Thu, 2006-12-14 at 12:22 -0800, Gary Funck wrote:
> The main difficulty is that GCC doesn't create new qualified
> types for declarations.  Rather, it sets TREE_READONLY()
> and TREE_THIS_VOLATILE() in the DECL node for declarations
> such as:
>    volatile int A[10];

If you look at the types created by the C front end, they are OK.
c_build_qualified_type knows how to handle an array correctly.

The problem arises in the DWARF2 output code.  gen_type_die calls
type_main_variant for all types other than vector types, which strips
off the const and volatile type modifiers.  Then it clumsily tries to
put them back later in gen_variable_die, except that for array types, it
puts them back in the wrong place.

This seems to answer the question I asked long ago.  Why are we trying
to put back qualifiers from the decl?  Because gen_type_die stripped
them off.  This seems wrong.

If we fix gen_type_die to stop calling type_main_variant, and if we fix
gen_variable_die to stop adding back the type qualifiers, then I get the
right result.  So I think I was on the right track before, we just need
another little change to gen_type_die in addition to what I already
described.

I haven't investigated this in detail yet.  There may be other parts of
the code that expect to see a type main variant here, so we might need
other cascading fixes.  This still seems fixable to me though.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com



  parent reply	other threads:[~2007-01-01 22:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-27 22:42 Gary Funck
2006-11-27 23:10 ` Daniel Jacobowitz
2006-11-27 23:30   ` Jim Blandy
2006-11-27 23:52     ` Daniel Jacobowitz
2006-11-27 23:45   ` Joseph S. Myers
2006-11-27 23:55     ` Daniel Jacobowitz
2006-12-14 20:22       ` Gary Funck
2006-12-15 22:36         ` Jim Blandy
2006-12-19 19:09           ` Gary Funck
2006-12-20  2:40           ` Gary Funck
2006-12-27  2:12             ` Jim Blandy
2007-01-01 22:16         ` Jim Wilson [this message]
2007-01-09 17:01           ` Gary Funck

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=1167689747.2505.17.camel@localhost.localdomain \
    --to=wilson@specifix.com \
    --cc=drow@false.org \
    --cc=gary@intrepid.com \
    --cc=gdb@sourceware.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