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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5556 - [64-bit] Wrong Implicit Conversion to Double
Summary: [64-bit] Wrong Implicit Conversion to Double
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
Reported: 2011年02月09日 19:56 UTC by David Simcha
Modified: 2011年02月10日 22:50 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2011年02月09日 19:56:56 UTC
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
}


AltStyle によって変換されたページ (->オリジナル) /