[Issue 16189] New: Optimizer bug, with simple test case
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jun 21 08:08:35 PDT 2016
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 at puremagic.com
Reporter: kkryukov at 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!".
--
More information about the Digitalmars-d-bugs
mailing list