Originally Posted by
Garry
Whoa ... bugs like that suck ... especially as it can be hard or next to impossible to locate unless you can take a look at the asm code created ...
That's how I found it - yeah I was a bit annoyed.
The assembler for a case statement (with case variable in R0) should have been:
Code:
A840 MOV R4,[R0]
06F4F5FF ADD R4,#0FFF5H
2D26 JMPR cc_Z,?C0077
But it was incorrectly compiled as:
Code:
A8E0 MOV R14,[R0]
F04E MOV R4,R14
06F4F5FF ADD R4,#0FFF5H
2D26 JMPR cc_Z,?C0077
Turns out the compiler was saving the value of the case variable in R14 to be re-used in statements within the same case block. Unfortunately the compiler "forgot" that it was using R14 for something else.
Regards
Paul