I warn anybody before using ARM Keil 4.13a. It generates defective code. I have spent several hours with debugging a code that has been already worked. The problem affects local variables of functions and passing arguments. Code has been wrongly compiled without any optimization. I have no courage and time to test optimizations.
I also encourage Keil not to publish Keil 4.13a any more.
Keil 4.12 seems to be OK.
I think I can second this. I am also having problems with pointers and passing arguments.
Look at this GIF animation:
http://bleyer.org/keil/ptr.gif
The "usbPackBufRx" function receives a "PackBuf" object through the "buf" pointer. It gets the actual object through a FIFO call, and the address value is, correctly, 0x2000_014C.
After that I call the "processBuf" function with "buf" as its argument. However inside that function, the buffer pointer value is passed as 0x0000_0000.
Also, the debugger is giving me some weird information in the Locals window. For example, some return value shows as 0x4C (byte) although it should be zero (int).
I wonder if Keil has proper regression tests when releasing new versions of the compiler. Any decent C test suite should have been able to catch this.
I hope we have a fix soon. I will revert back to 4.12.
Cheers.
Oops - I guess this happens when you are working on a Sunday @ 1AM.
On preparing my bug report to Kiel, I spotted an extra '&' that was killing my code. The funny thing is that also messed up the Locals window. Go figure.
It has already been pointed out that there are known issues with the Debugger...