www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5289] New: std.conv.parse!double() results in a segmentation fault.

reply d-bugmail puremagic.com writes:
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



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: -------
Nov 29 2010
next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 29 2010
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Nov 29 2010