This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Q: C++ FE emitting assignments to global read-only symbols?



On Apr 8, 2005, at 4:40 PM, Mark Mitchell wrote:


Daniel Berlin wrote:

Your transform is correct.
The FE is not. The variable is not read only.
It is write once, then read-only.

Diego, your analysis is exactly correct about what is happenning.


I agree, in principle. The C++ FE should not set TREE_READONLY on variables that require dynanmic initialization. Until now, that's not been a problem, and it does result in better code. But, it's now becoming a problem, and we have others way to get good code coming down the pipe.

I do think the C++ FE needs fixing before Diego's change gets merged, though. I can make the change, but not instantly. If someone files a PR, and assigns to me, I'll get to it at some not-too-distant point.

It would be good to have a way to mark things as "write once, then readonly" IMO.
It's very common, and you can do some of the same optimizations on such things
that you can do on true Readonly objects.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]