Bug 13998 – Wrong code with -O -inline, loops, and taking address of double
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2015-01-18T01:26:00Z
Last change time
2015-01-31T04:12:26Z
Keywords
wrong-code
Assigned to
nobody
Creator
dlang-bugzilla
Comments
Comment #0 by dlang-bugzilla — 2015-01-18T01:26:03Z
////////////////////////// test.d /////////////////////////
void main()
{
static ulong repr(double d) { return *cast(ulong*)&d; }
double[] arr = [3.0];
foreach (x; arr) assert(repr(arr[0]) == repr(arr[0]));
}
///////////////////////////////////////////////////////////
Assert is triggered when built with -m64 -O -inline.
Might not be reproducible 100% of the time.
Introduced in https://github.com/D-Programming-Language/dmd/pull/3620
Comment #1 by dlang-bugzilla — 2015-01-18T01:28:42Z
Interesting, I can reproduce this with older versions of DMD, but only on Windows. It's possible that this is not a regression, but the aforementioned change only exposed the bug on Linux.