Bug 3078 – NaN reported as equal to zero

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D1 (retired)
Platform
Other
OS
Linux
Creation time
2009-06-18T18:46:00Z
Last change time
2014-04-18T09:12:06Z
Keywords
wrong-code
Assigned to
nobody
Creator
andrei

Comments

Comment #0 by andrei — 2009-06-18T18:46:34Z
import std.math; void main() { double x[] = new double[1]; double a = x[0]; assert(a == 0); assert(x[0] == 0); assert(isnan(a)); assert(isnan(x[0])); } No assert fails in the code above - and one hour is gone off my life.
Comment #1 by andrei — 2009-06-19T06:10:23Z
I noticed that the bug manifests itself only when building with -O.
Comment #2 by fvbommel — 2009-06-19T06:27:42Z
This is present in both 1.045 and 2.030; setting version to 1.045 because D1 updates seem to be more likely to be forgotten for dual-version bugs (and because it was unset).
Comment #3 by bugzilla — 2009-07-09T02:51:35Z
Fixed dmd 1.046 and 2.031