[Issue 15466] New: Incorrect result for 'real'
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Dec 21 16:43:23 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15466
Issue ID: 15466
Summary: Incorrect result for 'real'
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: acehreli at yahoo.com
I was able to reduce the code to the following, which involves
std.datetime.benchmark. However, I have not investigated whether this is a
compiler or Phobos bug. Hence the vague subject. :(
The bug manifests itself only if the four conditions are satisfied in the
reduced code (-O, -inline, etc. do not make any difference):
import std.stdio;
import std.datetime;
alias T = real; // Must be 'real'
enum testCount = 7; // Must be > 6
T foo() { // Must return a value
return 42;
}
void main() {
// Must cast to void
const m = benchmark!(() => cast(void)foo)(testCount);
writeln(m[0].msecs);
}
The output of the program (test measurement) is not 0 (or a very small number
of milliseconds) as one would expect:
-9223372036854775808
Ali
--
More information about the Digitalmars-d-bugs
mailing list