D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7089 - Inconsistent results when comparing structs with NaNs
Summary: Inconsistent results when comparing structs with NaNs
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 major
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2011-12-10 09:27 UTC by David Simcha
Modified: 2018-01-19 22:45 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2011-12-10 09:27:01 UTC
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 Trass3r 2011-12-10 10:01:55 UTC
According to Kenji

*** This issue has been marked as a duplicate of issue 3789 ***
Comment 2 Kenji Hara 2011-12-10 11:44:11 UTC
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 Infiltrator 2014-03-19 22:16:35 UTC
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 Simen Kjaeraas 2018-01-19 22:45:31 UTC
Returns false for both 32 and 64 bit on windows with DMD 2.078.0.