https://issues.dlang.org/show_bug.cgi?id=12833
Issue ID: 12833
Summary: switch statement does not work properly when -inline
used
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Keywords: wrong-code
Severity: major
Priority: P1
Component: DMD
Assignee: [email protected]
Reporter: [email protected]
The following code does not work properly with -inline -- the program finishes
silently.
I tested on DMD2.065, git-head, and DMD1.076.
CODE:
import std.stdio;
ushort HIWORD(long x) { return cast(ushort)((x >> 16) & 0xFFFF); }
void test(int a)
{
switch (HIWORD(a)) {
case 1:
writefln("it works!"); // this makes no output if -inline used
break;
default:
}
}
void main()
{
test(0x1_0000);
}
COMMAND:
dmd -inline -m32 -run test.d
ENVIRONMENT:
Windows 7 64-bit
--