This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Removing -frwitable-strings
On Thu, 2003-12-18 at 14:49, Jamie Lokier wrote:
> Mark Mitchell wrote:
> > > It would seem that the front end would need to generate a static
> > > char[] array for each literal string, and use its address as the value
> > > of the literal string expression. If that were done, the back end could
> > > eliminate its support for -fwritable-strings.
> >
> > Yes.
> >
> > But, even that will not work because there are places in the front ends
> > that expect string constants to be STRING_CSTs.
> >
> > It's possible that the conversion you suggest could be done at tree->rtl
> > conversion time. That is the approach I would try if I had to implement
> > it.
>
> I'm not sure that would work. STRING_CST seems to suggest it's a
> _constant_ and some tree-level or tree generation optimisers might
> think they can constant-fold things like dereferencing characters in
> the string or strlen(). Or at least, they ought to be able to assume
> that without checking the -fwritable-strings flag.
Maybe...
I'm not sure how this actually works at present, but I don't think it
works as you expect. I think the optimizers still assume that constants
are constant, and I think that __builtin_strlen (for example) will still
return a constant when given a string constant.
I'm afraid that this, too, is in the realm of things that I'm too busy
to think more about.
I'm not really interested in reimplementing the feature; it seems like
we're going to get consensus that it should at least be deprecated in
GCC 3.4. To me, the open question is whether to deprecate it in 3.4
(which seems to be the current leaning) or remove it for 3.4 (which
people seem to think is perhaps too agressive).
--
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC