D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15861 - [REG 2.069] Wrong double-to-string conversion with -O
Summary: [REG 2.069] Wrong double-to-string conversion with -O
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 All
: P1 regression
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2016-04-01 16:25 UTC by Vladimir Panteleev
Modified: 2016-10-01 11:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2016-04-01 16:25:41 UTC
///////////////////////// test.d /////////////////////////
import std.format;

void main()
{
    assert(format("%.18g", 4286853117.0) == "4286853117");
}
//////////////////////////////////////////////////////////

Passes without -O, asserts with -O.

Introduced in https://github.com/D-Programming-Language/dmd/pull/4911
Comment 1 Walter Bright 2016-04-11 08:25:37 UTC
Sadly, this generates about 10,000 lines of assembler.
Comment 3 Vladimir Panteleev 2016-04-11 14:50:58 UTC
Thanks. In the future, you can let me know if you'd like a completely reduced test case.
Comment 4 github-bugzilla 2016-04-12 18:12:37 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/2d9a5bc18268a6c81e8cc69c2a036c5bc9c3875d
fix Issue 15861 - [REG 2.069] Wrong double-to-string conversion with -O

https://github.com/D-Programming-Language/dmd/commit/74ed68472924f4a7104af6ef369a9ad23920cbbf
Merge pull request #5650 from WalterBright/fix15861

fix Issue 15861 - [REG 2.069] Wrong double-to-string conversion with -O
Comment 5 Walter Bright 2016-04-12 21:44:44 UTC
(In reply to Vladimir Panteleev from comment #3)
> Thanks. In the future, you can let me know if you'd like a completely
> reduced test case.

I'd always prefer a completely reduced test case!
Comment 6 Walter Bright 2016-04-12 21:46:19 UTC
Vladimir's reduced test case:

void main()
{
    double val = 4286853117.;

    (){
        assert(val == 4286853117.);
    }();
}
Comment 7 github-bugzilla 2016-04-13 05:52:47 UTC
Commits pushed to stable at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/241f18c260618fe9b7083d29d8d975391a8a2561
Merge pull request #5650 from WalterBright/fix15861

fix Issue 15861 - [REG 2.069] Wrong double-to-string conversion with -O

https://github.com/D-Programming-Language/dmd/commit/388fb366bc309c174b63014efae273695082759d
Merge pull request #5655 from 9rnsr/fix15861

Cherry-pick commits for issue 15861 fix from master into stable
Comment 8 github-bugzilla 2016-04-17 16:07:21 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/241f18c260618fe9b7083d29d8d975391a8a2561
Merge pull request #5650 from WalterBright/fix15861

https://github.com/dlang/dmd/commit/388fb366bc309c174b63014efae273695082759d
Merge pull request #5655 from 9rnsr/fix15861
Comment 9 github-bugzilla 2016-10-01 11:46:01 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/2d9a5bc18268a6c81e8cc69c2a036c5bc9c3875d
fix Issue 15861 - [REG 2.069] Wrong double-to-string conversion with -O

https://github.com/dlang/dmd/commit/74ed68472924f4a7104af6ef369a9ad23920cbbf
Merge pull request #5650 from WalterBright/fix15861