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.
We had a bug that was there all along but was masked by other factors. See my post on "using 0."