Thread overview
[Issue 24819] Optimizer changes result of float calculations on 32-bit
Oct 15
Dennis
Oct 24
Dlang Bot
Oct 24
Dlang Bot
Oct 24
Dlang Bot
5 days ago
Dlang Bot
October 15
https://issues.dlang.org/show_bug.cgi?id=24819

--- Comment #1 from Dennis <dkorpel@live.nl> ---
Reduced:

```
import core.stdc.stdio;

pragma(inline, true)
double sqrt(double x)
{
    static import core.math;
    return core.math.sqrt(x);
}

void main()
{
    double q = -1.0;
    double r = q + 0.1;
    double result = sqrt(-r);
    printf("%f\n", result);
}
```

--
October 15
https://issues.dlang.org/show_bug.cgi?id=24819

Mark Visser <mark@sarc.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark@sarc.nl

--
October 15
https://issues.dlang.org/show_bug.cgi?id=24819

Mark Visser <mark@sarc.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|mark@sarc.nl                |

--
October 24
https://issues.dlang.org/show_bug.cgi?id=24819

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
The problem shows up with this optimization:

in localize():

Moved equation x(3) =  (r(1) ^  -9223372036854775808LL );

el:0x2ade880 cnt=0 = TYdouble 0x2ade6c0 0x2ade810
 el:0x2ade6c0 cnt=0 var TYlong  x
 el:0x2ade810 cnt=0 ^ TYlong 0x2ade7a0 0x2ade000
  el:0x2ade7a0 cnt=0 var TYlong  r
  el:0x2ade000 cnt=0 const TYlong -9223372036854775808LL

replacing:

el:0x2ade9d0 cnt=0 var TYdouble  x

which fouls up the x87 code generation.

--
October 24
https://issues.dlang.org/show_bug.cgi?id=24819

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #17023 "fix bugzilla Issue 24819 - Optimizer changes result of float calculat…" fixing this issue:

- fix bugzilla Issue 24819 - Optimizer changes result of float calculations on 32-bit

https://github.com/dlang/dmd/pull/17023

--
October 24
https://issues.dlang.org/show_bug.cgi?id=24819

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #17023 "fix bugzilla Issue 24819 - Optimizer changes result of float calculat…" was merged into master:

- 06a4bff4640e7ffaf329288ec253d2cd961e0a64 by Walter Bright:
  fix bugzilla Issue 24819 - Optimizer changes result of float calculations on
32-bit

https://github.com/dlang/dmd/pull/17023

--
October 24
https://issues.dlang.org/show_bug.cgi?id=24819

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #17028 "fix bugzilla Issue 24819 - Optimizer changes result of float calculat…" was merged into stable:

- 6a53ff6520c1904134572d39ebceb1cdcd2dd662 by Walter Bright:
  fix bugzilla Issue 24819 - Optimizer changes result of float calculations on
32-bit (#17023)

  (cherry picked from commit 88d1e8fc37428b873f59d87f8dff1f40fbd3e7a3)

https://github.com/dlang/dmd/pull/17028

--
5 days ago
https://issues.dlang.org/show_bug.cgi?id=24819

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #17069 "Merge stable" was merged into master:

- 735193cc36db6b2fa2c50270fae3414316323d9b by Walter Bright:
  fix bugzilla Issue 24819 - Optimizer changes result of float calculations on
32-bit (#17023)

  (cherry picked from commit 88d1e8fc37428b873f59d87f8dff1f40fbd3e7a3)

https://github.com/dlang/dmd/pull/17069

--