Hi, I've recently been experiencing some concern regarding the behaviour of a program, for which the optimiser, when set to favour size [OPTIMIZE (6, SIZE)], occasionally leads to the contents of a global variable getting trashed/overwritten. If the optimisation settings are altered to favour speed, this no longer happens. It appears not to be an issue with specific XDATA address (where the variable resides), since changing the variables location doesn't prevent this from happening. The variable in question is only ever modified via a single increment within a timer interrupt function. Has anyone else experienced anything like this? IDE: uV2 Compiler: V6.23a Link/Loc: V4.23 Thanks for any illumination... David
Excellent! Thanks, Jon, that was what I was after. Sadly, in the way of things in the real world, I can't get the original version to fail now, but I'll be patient, and I'll get there. As it stands now, ALL functions called from ISRs are marked 'reentrant', and I think this will cure my problem. But not all of them need to be reentrant; some of them only need be excluded from overlaying to cure the problem. [They are only called by one ISR, and never from the main thread.] Thanks everyone for your help! Steve Merrick Software Designer Tribal Data Systems