January 05, 2021 [Issue 21526] New: x87 not rounding to precision on assignment on some platforms | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21526 Issue ID: 21526 Summary: x87 not rounding to precision on assignment on some platforms Product: D Version: D2 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: bugzilla@digitalmars.com For the code: float f(float a, float b) { float c = a + b; float d = c - b; return d; } When compiling with -m32 -O, on Windows c is stored to memory rounding it to float precision. This is correct. push EAX push EAX fld float ptr 010h[ESP] fadd float ptr 0Ch[ESP] fstp float ptr [ESP] // store fld float ptr [ESP] // reload fsub float ptr 0Ch[ESP] fstp float ptr 4[ESP] fld float ptr 4[ESP] add ESP,8 ret 8 On Linux, it does not, which is incorrect. fld float ptr 8[ESP] fadd float ptr 4[ESP] fsub float ptr 4[ESP] ret 8 -- |
Copyright © 1999-2021 by the D Language Foundation