D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7581 - Compiler uses wrong instructions to move complex value from ST to xmm registers
Summary: Compiler uses wrong instructions to move complex value from ST to xmm registers
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 All
: P2 critical
Assignee: yebblies
URL:
Keywords: pull, wrong-code
Depends on:
Blocks:
 
Reported: 2012-02-25 04:43 UTC by yebblies
Modified: 2015-06-09 05:11 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 yebblies 2012-02-25 04:43:17 UTC
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 yebblies 2012-02-25 05:24:54 UTC
https://github.com/D-Programming-Language/dmd/pull/760

This is fixed by pull 760
Comment 2 yebblies 2012-02-26 08:37:39 UTC
New pull

https://github.com/D-Programming-Language/dmd/pull/769
Comment 3 github-bugzilla 2012-04-24 21:54:30 UTC
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 github-bugzilla 2012-04-24 21:54:59 UTC
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