Thread overview
[Issue 5289] New: std.conv.parse!double() results in a segmentation fault.
Nov 29, 2010
Jonathan M Davis
Nov 29, 2010
Bernard Helyer
November 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5289

           Summary: std.conv.parse!double() results in a segmentation
                    fault.
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: jmdavisProg@gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2010-11-29 03:28:32 PST ---
This program

import std.conv;
import std.stdio;

void main()
{
    writeln(parse!double("1.0"));
}


results in a segfault. In fact, _every_ value that I've tried to parse to a double or a float has resulted in a segfault. Maybe there are some that work, but I haven't found them, and the ones that I need to work don't.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5289


Bernard Helyer <blood.of.life@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |blood.of.life@gmail.com


--- Comment #1 from Bernard Helyer <blood.of.life@gmail.com> 2010-11-29 03:55:04 PST ---
It's because you're using a string literal. parse takes it's argument by ref, and advances the array. The string literal is not an lvalue, but is permitted by DMD anyway -- this is the real bug. If you put the string in a variable, it will work.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 29, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5289


Lars T. Kyllingstad <bugzilla@kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@kyllingen.net
         Resolution|                            |DUPLICATE


--- Comment #2 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2010-11-29 05:03:01 PST ---
*** This issue has been marked as a duplicate of issue 4309 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------