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: Removing -frwitable-strings


On Thu, 2003-12-18 at 12:37, Joe Buck wrote:
> On Thu, Dec 18, 2003 at 11:02:06AM -0800, Mark Mitchell wrote:
> > On Thu, 2003-12-18 at 10:57, Jamie Lokier wrote:
> > > Someone said that -fwritable-strings could be implemented in the front
> > > end, but currently it isn't and that adds unwanted code to
> > > the back end.
> > > 
> > > Perhaps it's quite a simple change to make string constants have type
> > > "char[]" in the C and C++ front ends instead of "const char[]"?  (No,
> > > I'm not volunteering).
> > 
> > It ain't that easy, sadly.
> 
> 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.

-- 
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC


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