Bug 7581 – Compiler uses wrong instructions to move complex value from ST to xmm registers

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2012-02-25T04:43:00Z
Last change time
2015-06-09T05:11:57Z
Keywords
pull, wrong-code
Assigned to
yebblies
Creator
yebblies

Comments

Comment #0 by yebblies — 2012-02-25T04:43:17Z
Both asserts should pass, but don't because dmd loads the nan onto the fp stack, stores it into memory _as a double_, then loads it into the xmm registers as a double and returns it. The comparison code treats the xmm regs as if they contain floats, giving the wrong result. void main() { cfloat a() { return cfloat.nan; } assert(a() != 0); }
Comment #1 by yebblies — 2012-02-25T05:24:54Z
Comment #2 by yebblies — 2012-02-26T08:37:39Z
Comment #3 by github-bugzilla — 2012-04-24T21:54:30Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e45925dafe7a9c71fc6eaaa852ed526e01768981 yebblies' fix Issue 7581 - Compiler uses wrong instructions to move complex value from ST to xmm registers
Comment #4 by github-bugzilla — 2012-04-24T21:54:59Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0cf3c08642bb0cae819464e6a1aaecfb09b2d03c yebblies' fix Issue 7581 - Compiler uses wrong instructions to move complex value from ST to xmm registers