AnsweredAssumed Answered

Optimization skips some functions

Question asked by MarcZ on Apr 19, 2013
Latest reply on Apr 23, 2013 by MarcZ

Hi,

 

I realized that in my code, there were some function in Debug mode that were not even executed when the Optimization is turned on.

Here is an example:

 

void TestData(unsigned short* address);

void TestAddress(unsigned short* address);

 

void TestData(unsigned short* address)

{

          unsigned short int datatest;

 

          for (datatest=0; datatest<32 ; datatest++)

          {

                    address[0]=datatest;

          }

}

 

 

void TestAddress(unsigned short* address)

{

          unsigned short int addresstest;

 

          for (addresstest=0; addresstest<32 ; addresstest++)

          {

                    address[addresstest]=0xFF;

          }

}

 

These functions are almost the same. When the Optimization is not turned on, everything is ok and I can put a breakpoint.

The problem is when I want to turn on the Optimization, I can't put a breakpoint in the TestData function. And the function is not working at all either.

 

I tried to write it in a example Project exactly like this. Same issue.

 

Does the Optimization (even the smallest one) can really cause this kind of issue? Because in the future I will need to debug with optimization...

Could you also try this in an example project to see if you have the same issue? I am working on a ADSP-21489 EZ Kit by the way.

 

Thank you,

Marc

Outcomes