[phobos] [D-Programming-Language/phobos] 601c75: Improve parsing error handling

Jonathan M Davis jmdavisProg at gmx.com
Sun Sep 4 22:54:35 PDT 2011


On Sunday, September 04, 2011 22:49:00 Brad Roberts wrote:
> On 9/4/2011 10:31 PM, Jonathan M Davis wrote:
> > On Sunday, September 04, 2011 22:12:35 Walter Bright wrote:
> >> On 9/4/2011 10:03 PM, Walter Bright wrote:
> >>> This causes the std.conv unittests to fail on linux with a seg
> >>> fault.
> >> 
> >> Please fix as this is blocking the beta.
> > 
> > A fix has been merged in. It looks like std.conv.parse (which takes a
> > string by ref) was accepting string literals and then segfaulting on
> > them.
> > 
> > - Jonathan M Davis
> 
> This doesn't feel like a fix so much as a workaround.  It doesn't segfault,
> which is good, but it leaves the underlying problem ready to recur pretty
> easily.  Is there a problem with spec, the compiler implementation, phobos,
> ...?

It's a bug in dmd. string literals aren't lvalues and shouldn't be accepted as 
such. I thought that there was a bug reported specifically on this, but I don't 
see one at the moment. The closest that I see is

http://d.puremagic.com/issues/show_bug.cgi?id=4539

So, I should probably report it. What makes it nastier is that string literals 
aren't put in read-only memory on Windows, so they work in this sort of 
situation whereas on Linux, they blow up, since it _does_ put string literals 
in read-only memory.

- Jonathan M Davis


More information about the phobos mailing list