digitalmars.D.bugs - [Issue 16189] New: Optimizer bug, with simple test case
- via Digitalmars-d-bugs (36/36) Jun 21 2016 https://issues.dlang.org/show_bug.cgi?id=16189
https://issues.dlang.org/show_bug.cgi?id=16189 Issue ID: 16189 Summary: Optimizer bug, with simple test case Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: kkryukov gmail.com Consider this code: === a.d === struct T { long a, b; } T[] data = [{0,0}]; void main() { int a = 0; for (int i = 0; i >= 0; i--) { data[0] = data[a]; a--; } assert(a == -1); // Fails with -O } === end === Fails when built with "-O", succeeds without "-O". The full command line: dmd a.d -ofa.exe -O dmd a.d -ofb.exe Windows 7, dmd 2.071.0 If you add "-m64" to dmd command, the bug disappears, but re-appears if "int a" is changed to "long a". Reduced from a large project with the help of dustmite and a lot of "WTF!". --
Jun 21 2016