I wonder did you really change the value of the local variables in the 'local scope'?
I mean if you did not change the value of the local variables or changed them somewhere outside the 'local scope', for instance, within a ISR, that could occur depends on your compiler and optimization level. Some compilers might consider the 'unchanged' variable is no use at all and remove them from the target code for optimization.
So, qualify them as 'volatile' to prevent that, especially when you deal with variables changed in ISR. The following is an example from CW's help.
volatile int x;
void main(void) {
x = 0;
...
if (x == 0) { // without volatile attribute, the
// comparison may be optimized away!
Error(); // Error() is called without compare!
}
}