https://issues.dlang.org/show_bug.cgi?id=12833
--- Comment #1 from Kenji Hara <k.hara...@gmail.com> --- This is dmd backend isuse rather than -inline switch. The test function is inlined to: long x = cast(long)a; switch (cast(int)(cast(ushort)(x >> 16 & 65535L))) { case 1: { writefln("it works!"); break; } default: { } } And the condition of switch statement is always 0. Reduced test case (can reproduce the issue without -inline): extern(C) int printf(const char*, ...); void main() { int a = 0x1_0000; //00402016: b800000100 mov eax, 0x10000 //0040201b: 8945ec mov [ebp-0x14], eax long x = cast(long)a; //0040201e: 89c2 mov edx, eax //00402020: c1fa1f sar edx, 0x1f //00402023: 8945f4 mov [ebp-0xc], eax //00402026: 8955f8 mov [ebp-0x8], edx int num = cast(int)(cast(ushort)(x >> 16 & 65535L)); // problem! //00402029: 0facd010 shrd eax, edx, 0x10 //0040202d: c1fa10 sar edx, 0x10 //00402030: 25ffff0000 and eax, 0xffff //00402035: 31d2 xor edx, edx // <-- //00402037: 8955fc mov [ebp-0x4], edx // <-- if (num == 1) //0040203a: 83fa01 cmp edx, 0x1 //0040203d: 7510 jnz 0x40204f D main test.d:15 { printf("it works!\x0a"); } else assert(0); // line 15 } --