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.
Comment #2 by bugzilla — 2015-01-30T22:09:07Z
Can repro on Windows 64 bit.
Comment #3 by bugzilla — 2015-01-31T01:19:35Z
Comment #4 by github-bugzilla — 2015-01-31T04:12:25Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/97b5326d4317e0d171c0087b367eed5e5334305f fix Issue 13998 - Wrong code with -O -inline, loops, and taking address of double https://github.com/D-Programming-Language/dmd/commit/f1b6d1386480936cf2f53475e88a56f8a3ed7507 Merge pull request #4359 from WalterBright/fix13988 [REG] fix Issue 13998 - Wrong code with -O -inline, loops, and taking address of double