This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

optimisation settings causing odd behaviour

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

Parents
  • I have had similar problems many times before. Usually, it was a problem in my code.

    If you know which variables are getting overwritten, you can use the uVision2 Simulator to set a breakpoint on write access to those variables. Then you can see exactly where the problem occurs.

    You may also want to consider upgrading to the latest version (7.04).

    Jon

Reply
  • I have had similar problems many times before. Usually, it was a problem in my code.

    If you know which variables are getting overwritten, you can use the uVision2 Simulator to set a breakpoint on write access to those variables. Then you can see exactly where the problem occurs.

    You may also want to consider upgrading to the latest version (7.04).

    Jon

Children
No data