Bug 365 – Regression: Bad code generation for floating point == and !=

Status
RESOLVED
Resolution
DUPLICATE
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-09-24T13:52:00Z
Last change time
2014-02-15T13:22:10Z
Keywords
wrong-code
Assigned to
bugzilla
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2006-09-24T13:52:09Z
NaNs are currently comparing equal to zero! >, >=, !<>=, etc all seem to be OK. ------- void main() { real x = real.nan; assert( x!=0 ); // fails if (x==0) assert(0); // fails }
Comment #1 by thomas-dloop — 2006-09-29T03:20:41Z
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [email protected] schrieb am 2006-09-24: > http://d.puremagic.com/issues/show_bug.cgi?id=365 > NaNs are currently comparing equal to zero! >>, >=, !<>=, etc all seem to be OK. > ------- > void main() > { > real x = real.nan; > assert( x!=0 ); // fails > if (x==0) assert(0); // fails > } Added to DStress as http://dstress.kuehne.cn/compile/o/opEquals_06_A.d http://dstress.kuehne.cn/compile/o/opEquals_06_B.d http://dstress.kuehne.cn/compile/o/opEquals_06_C.d http://dstress.kuehne.cn/run/o/opEquals_06_D.d http://dstress.kuehne.cn/run/o/opEquals_06_E.d http://dstress.kuehne.cn/run/o/opEquals_06_F.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFHOLcLK5blCcjpWoRAjU4AJ9V52QPfPZ6S9y27DuqBxKjv1IvVQCfS6hJ UVgj8nqZ50tE0Q3TBBJTn4Y= =iS3i -----END PGP SIGNATURE-----
Comment #2 by aldacron — 2006-09-29T09:35:22Z
Thomas Kuehne wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > [email protected] schrieb am 2006-09-24: >> http://d.puremagic.com/issues/show_bug.cgi?id=365 > >> NaNs are currently comparing equal to zero! >>> , >=, !<>=, etc all seem to be OK. >> ------- >> void main() >> { >> real x = real.nan; >> assert( x!=0 ); // fails >> if (x==0) assert(0); // fails >> } > > Added to DStress as > http://dstress.kuehne.cn/compile/o/opEquals_06_A.d > http://dstress.kuehne.cn/compile/o/opEquals_06_B.d > http://dstress.kuehne.cn/compile/o/opEquals_06_C.d > http://dstress.kuehne.cn/run/o/opEquals_06_D.d > http://dstress.kuehne.cn/run/o/opEquals_06_E.d > http://dstress.kuehne.cn/run/o/opEquals_06_F.d > > Thomas > > > -----BEGIN PGP SIGNATURE----- > > iD8DBQFFHOLcLK5blCcjpWoRAjU4AJ9V52QPfPZ6S9y27DuqBxKjv1IvVQCfS6hJ > UVgj8nqZ50tE0Q3TBBJTn4Y= > =iS3i > -----END PGP SIGNATURE----- I just discovered that this is duplicate of BUG 291 (except that this bug report includes != ). However, I really think this is a critical error -- it's caused severe problems in some of my mathematical code, where I make significant use of NaNs.
Comment #3 by thomas-dloop — 2006-10-02T03:11:52Z
*** This bug has been marked as a duplicate of 291 ***
Comment #4 by bugzilla — 2006-10-04T19:59:34Z
Fixed DMD 0.168