Hi Francesco,
I definitely don't think you have to go so far as to replace all switch statements with if's -- the bug I found is *very* specific to a "do" loop as the *very* first statement of a switch case... If your code doesn't look like this:
switch (...) {
...
case ...:
do {
...
} while (...);
...
break;
...
}
(with the "case" immediately followed by a "do" ), then you're fine.
Does your program stop before or after interrupts are enabled? If it is after, it is possible interrupts are trashing registers as well (which optimized code would be more susceptible to). How, exactly, does the program stop? With an exception? If so, you can get a lot of information from looking at the exception frame on the stack. Displaying the memory at address a7 should reveal two words as defined in section 11.1.2 of the ColdFire Family Programmer's Reference Manual.
I am sorry -- I did not mean to scare you about the compiler -- in general it is very well behaved!!! :smileyhappy:
-- Rich