Bug 7089 – Inconsistent results when comparing structs with NaNs
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-12-10T09:27:01Z
Last change time
2018-01-19T22:45:31Z
Keywords
wrong-code
Assigned to
No Owner
Creator
David Simcha
Comments
Comment #0 by dsimcha — 2011-12-10T09:27:01Z
When comparing structs that contain a NaN for equality, the results differ between 32- and 64-bit binaries on DMD 2.057 beta:
// test2.d:
import std.stdio;
struct S {
double d; // NaN
}
void main() {
S s;
writeln(s == S.init);
}
$ dmd test2.d -m32
$ ./test2
true
$ dmd test2.d -m64
$ ./test2
false
Comment #1 by hoganmeier — 2011-12-10T10:01:55Z
According to Kenji
*** This issue has been marked as a duplicate of issue 3789 ***
Comment #2 by k.hara.pg — 2011-12-10T11:44:11Z
Umm. Yes, issue 3789 is not yet fixed, but it is front-end issue.
Then -m32 and -m64 should output same wrong result 'true', but it doesn't.
It seems to me that there is a back-end or a optimizer bug.
(Not only issue 3789)
Comment #3 by lt.infiltrator — 2014-03-19T22:16:35Z
As of v2.064, this returns 'true' on a 64-bit system with -m64. Can anybody test -m32? (I don't have 32-bit phobos.)
Comment #4 by simen.kjaras — 2018-01-19T22:45:31Z
Returns false for both 32 and 64 bit on windows with DMD 2.078.0.