Does any one else have problems with the higher levels of optimisation available to C51? With common block subroutines switched on, sometimes, just sometimes, C51 will generate completely wrong code. I have noticed that the problems are often associated with pointers that are automatic variables and where there is a variable of the same name in another function. Common block subroutines have a dramatic affect on code size, but I don't use this level of optimisation because it just does not seem to be reliable.
We can confirm that your problem is most likely fixed in the current version. Take a look to http://www.keil.com/update/_c51/c51v703a.htm which are the release notes of the current revision. In the first item under V7.02 we refer to the fact that we have corrected some problems with linker code packing.