This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch: stab info for const fields
On Thu, Oct 31, 2002 at 11:04:30AM -0800, Mark Mitchell wrote:
>
> Yes. The C front end is lying about the types of things. The type of
> "const int a" is "const int"; the C front end is claiming that its type
> is "int" and that the variable is "readonly", which is not a notion in
> the C programming language.
>
> Your patch changes the language-independent debugging output to do the
> wrong thing. A front end, like C++, may set TREE_READONLY on a VAR_DECL
> when it knows the variable cannot change -- independently of the
> variable's type.
>
> We certainly don't want to introduce regressions on the release branch,
> but there are some parts of GCC that are a mess, and we need to bite the
> bullet on cleaning them up. That will introduce some regressions, in
> the short term, but it's the only path towards a more stable compiler
> in the future.
In general I think we encode way too much information in DECLs which
is redundant with their TYPEs. Off the top of my head: I don't see
any legitimate reason why the size, size_unit, arguments, attributes,
and possibly pointer_alias_set fields, and a bunch of the flags should
ever differ from the corresponding field in TREE_TYPE (decl).
zw