Bug 5556 – [64-bit] Wrong Implicit Conversion to Double

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2011-02-09T19:56:00Z
Last change time
2011-02-10T22:50:47Z
Keywords
wrong-code
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-02-09T19:56:56Z
The following weird result happens only with -m64 enabled. To reproduce the bug from this test case, -inline must be disabled to prevent the two functions from being inlined, though in the more complex cases that I reduced it from inlining could be enabled. import std.stdio; float fun(float[] data, sizediff_t k) { stderr.writeln("Returning ", data[k]); // Prints "Returning 2" return data[k]; } double gun(float[] data) { return fun(data, data.length / 2); } void main() { float[] test = [1,4,2,3,5]; stderr.writeln(gun(test)); // Prints 5.30499e-215 }
Comment #1 by bugzilla — 2011-02-10T22:50:47Z