Version 5.1 C51.exe generates code that randomly resets when compiled optimized level 9, favor size, unless all switch statements are replaced with if-then. This is on years-old stable code that recently outgrew its 32K boundary, which is why we had to optimize for size. No other change is made, and the code runs fine.