From: "Gary Funck" <gary@intrepid.com>
To: <gdb@sourceware.org>
Cc: "'Daniel Jacobowitz'" <drow@false.org>,
"'Jim Wilson'" <wilson@specifix.com>,
"'Jim Blandy'" <jimb@codesourcery.com>
Subject: RE: how to support C type qualifiers applied to arrays?
Date: Tue, 19 Dec 2006 19:09:00 -0000 [thread overview]
Message-ID: <001301c723a1$1f170e60$0a0a0a0a@DELORIAN> (raw)
In-Reply-To: <m3psak3hwh.fsf@codesourcery.com>
Jim Blandy wrote:
>
> "Gary Funck" <gary@intrepid.com> writes:
> > 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];
>
> Ugh. That's a shame. Can't dwarf2out.c fix things up as it builds
> the tree of struct die_structs from the GCC 'tree' type tree?
In theory, it should be possible. I worked on this a bit, but I think
to do it right, this fix will require contribution/direction from someone
more conversant in the GCC front-end, and more knowledgeable about how
the other language front-ends use both the DWARF 2 generation
routines, and the extent to which they depend upon the type information
remaining in its current form.
Three approaches to fixing the front end to create
appropriate DWARF 2 information come to mind:
(1) Change the GCC front-end, so that when it creates
type information and associates the type information
with a declaration that it fully qualifies the type definition,
in a way that preserves language semantics, yet also ensures
that the correct DWARF 2 information is generated for qualified
types.
(2) Create the fully qualified type definition in dwarf2out.c
(probably in routines that handle DECL items such as
gen_formal_parameter_die(), gen_variable_die() and gen_field_die()).
There are two likely sub-approaches: (i) keep this fully
qualified type definition on the side, parallel to the existing
type definition structure, or (ii) smash the new fully qualified
type into the DECL node's TREE_TYPE() value. Keeping a
parallel definition may be difficult because various parts
of dwarfout.c may need to refer back to the DECL node's type
value, and all places that do this will have to be found and fixed.
Cross-type references and typedef's create another set of problems.
Rewriting the declaration's type value is the most straightforward,
but runs the risk of violating various assumptions made by the
language front-ends, and will require a rather elaborate "deep copy"
mechanism to make sure the fix up is done correctly.
(3) Run a final pass over the internal DWARF tree built within
dwarfout.c to fix up the type qualifiers, basically propagating
the const_ and volatile_ qualifiers down to lower levels as
required. This is probably doable, but will slow down DWARF
generation for all compilations, even if most compilations
seldom use "const" and "volatile" (and other qualifiers, such
as UPC's "shared", "strict", and "relaxed"). In this case, it
seems that dwarf2out.c is fixing representation
issues that more correctly should be solved in the front-end.
Given the tradeoffs, choice (1) above, where the type description
is fully qualified at the time the type is bound to the DECL item,
seems more correct, but may impact the correct operation of
the various language front-ends and therefore will require more
care and more study. Choice (2) is perhaps a bad compromise,
and choice (3) is likely workable, but kludgy.
next prev parent reply other threads:[~2006-12-19 19:09 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 [this message]
2006-12-20 2:40 ` Gary Funck
2006-12-27 2:12 ` Jim Blandy
2007-01-01 22:16 ` Jim Wilson
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='001301c723a1$1f170e60$0a0a0a0a@DELORIAN' \
--to=gary@intrepid.com \
--cc=drow@false.org \
--cc=gdb@sourceware.org \
--cc=jimb@codesourcery.com \
--cc=wilson@specifix.com \
/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