This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Troubleshooting Optimizer issues?

Other Parts Discussed in Thread: AM5728

I seem to be in need of some help/guidance in troubleshooting issues that I believe are related to the optimizer.

I have an existing code base (C++,C) that was developed under DSP/BIOS for the C6482 and C6748 processors.  The C6000 Compiler version 7.4.4 was used.  opt_level = 3 was used.  We have a suite of unit tests that all pass.

Now, we are porting this same code base and unit tests to the AM5728.  Using the C6000 Compiler 8.1.0 and Sys/Bios.  I started with opt_level = off and all the unit tests pass as I would have expected.

However, I have now tried opt_level = 0 and greater and unit tests start to fail.  If I then customize the opt_level for a specific file to off, I can get the tests to pass again.  I have yet to find the exact combination of files needed to have opt_level = off to make all the unit tests pass again.  What really concerns me is that not all code is covered by unit tests, so we could have functional failures due to the optimizer. 

Is this a common scenario?  What methodology is recommended when turning on the optimizer?  File by file?  It is possible our code might not even run without the optimizer turned on to some degree, since we are a realtime system, so this issue will become quite important soon when we start SW/HW integration.

  • Christopher Peters said:
    Is this a common scenario?

    No.  Problems do occur, unfortunately.  But they are not common.  That said, it seems you are experiencing a problem.

    At this point, the idea is to somehow isolate the problem into a test case you can submit to us for analysis.  Consider using this method.  Enable optimization for all files.  We already know that fails.  Then disable optimization for one file at a time.  Use --opt_level=off.  When all tests pass, you have found the problem file.

    It may make sense to isolate the problem function within the problem file.  Resume building the problem file with optimization, but use the FUNCTION_OPTIONS pragma to disable optimization for one function at a time.  When the tests pass, you have found the problem function.  Please read about the FUNCTION_OPTIONS pragma in the C6000 compiler manual.

    Once you have isolated the problem, submit a preprocessed form of the source code.  Indicate where to look for the problem.  And show the build options exactly as the compiler sees them.

    I realize this is a lot of work for you.  But this is the only way I see forward.

    Thanks and regards,

    -George