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

Optimization issue

Hello fellow coders,

I have a problem with the following lines of code. I believe it's an optimization issue.

// Is page1 full?
   RAM_A16 = PAGE1;
   if(lib.full == TRUE)
   {
   // Is page0 full?
      RAM_A16 = PAGE0;
      if((lib.full) == TRUE)
      {
      // Handle full library.
         handle_full_page(record);
      }
   }

lib and RAM_A16 are declared as:
   lib_stats xdata lib _at_ 0x8A3;

   RAM_A16 BIT P1.6
I have tried to declare lib as volatile and lowering the optimization level, both with the same result:

On page 1 of the xram (RAM_A16 = PAGE1), lib.full is TRUE, which is evaluated correctly, but when switching to page 0 of the xram (RAM_A16 = PAGE0), lib.full is FALSE, but is evaluated to TRUE.

Any help would be appreciated.

TIA,

Anders.

0