Skip to content

Commit

Permalink
Merge pull request #5650 from WalterBright/fix15861
Browse files Browse the repository at this point in the history
fix Issue 15861 - [REG 2.069] Wrong double-to-string conversion with -O
  • Loading branch information
WalterBright committed Apr 12, 2016
2 parents 36a2929 + 2d9a5bc commit 74ed684
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/backend/cgelem.c
Expand Up @@ -3498,12 +3498,11 @@ STATIC elem * eleq(elem *e, goal_t goal)
if (tysize(e1->Ety) == 2 * REGSIZE &&
e1->Eoper == OPvar &&
e2->Eoper == OPvar &&
goal == GOALnone
goal == GOALnone &&
!tyfloating(e1->Ety)
)
{
tym_t ty = (REGSIZE == 8) ? TYllong : TYint;
if (tyfloating(e1->Ety) && REGSIZE >= 4)
ty = (REGSIZE == 8) ? TYdouble : TYfloat;
ty |= e1->Ety & ~mTYbasic;
e2->Ety = ty;
e->Ety = ty;
Expand Down
10 changes: 10 additions & 0 deletions test/runnable/test15861.d
@@ -0,0 +1,10 @@
// REQUIRED_ARGS: -O
// https://issues.dlang.org/show_bug.cgi?id=15861

import std.format;

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

0 comments on commit 74ed684

Please sign in to comment.