Issue 5649 - std.conv.parse faulty for floating point with -O -m32
Summary: std.conv.parse faulty for floating point with -O -m32
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Linux
: P2 regression
Assignee: No Owner
URL:
Keywords: wrong-code
: 8120 (view as issue list)
Depends on:
Blocks:
 
Reported: 2011-02-23 20:33 UTC by Ali Cehreli
Modified: 2013-03-04 01:50 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ali Cehreli 2011-02-23 20:33:02 UTC
The following assert fails when compiled with dmd's command line options -O -m32:

import std.conv;

void main()
{
    char[] input = "1.5e3".dup;
    assert(1500 == parse!double(input));  // <-- FAILS
}

It fails for float and real as well.

Please note that this combination works: -O -m64

Ali
Comment 1 David Simcha 2011-02-24 06:24:18 UTC
Under platform, please put x86 if it's a 32-bit bug, even if you ran the code on a 64-bit machine. 

I can also reproduce this on Windows.  Note that the answer is correct if -release is also enabled.
Comment 2 David Simcha 2011-02-24 06:53:15 UTC
This one was introduced in DMD 2.048 -> it's a regression.  Also, since optimization settings affect the result, I think it's safe to call this a wrong-code bug.
Comment 3 Don 2011-02-24 09:14:29 UTC
This was fixed a couple of days ago.

https://github.com/D-Programming-Language/dmd/commit/597d233d1111a0d81382db265df07ba15bff1b0c
Comment 4 Don 2013-03-04 01:50:49 UTC
*** Issue 8120 has been marked as a duplicate of this issue. ***