diff --git a/src/coreclr/interpreter/compiler.cpp b/src/coreclr/interpreter/compiler.cpp index 0d318fe6b9cb42..2e90db063fc08d 100644 --- a/src/coreclr/interpreter/compiler.cpp +++ b/src/coreclr/interpreter/compiler.cpp @@ -9478,6 +9478,11 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo) m_ip += 4; const uint8_t *nextIp = m_ip + n * 4; m_pStackPointer--; + + // Empty switch (n=0) is a no-op that just consumes the stack value. + if (n == 0) + break; + InterpBasicBlock **targetBBTable = getAllocator(IMK_SwitchTable).allocate(n); uint32_t *targetOffsets = getAllocator(IMK_SwitchTable).allocate(n);