Patch: stab info for const fields
Mark Mitchell
mark@codesourcery.com
Thu Oct 31 11:06:00 GMT 2002
--On Thursday, October 31, 2002 10:25:27 AM -0800 Dale Johannesen
<dalej@apple.com> wrote:
>
> On Thursday, October 31, 2002, at 09:45 AM, Mark Mitchell wrote:
>>>> The right fix is to change that behavior in the C front end the same
>>>> way that I changed the C++ front end a couple of years ago.
>>>
>>> How much of a can of worms is doing it this way?
>>
>> It took me a day or two to make the changes, and there were a few bugs
>> that trickled in over the next couple of weeks.
>
> OK, thanks. Given that, it's very likely that trying to do as you
> suggest is going to introduce regressions. Do you say this is "right"
> for some reason besides aesthetics?
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.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
More information about the Gcc-patches
mailing list