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.

[C6000] Debugging Compiler Optimization

This is a C66xx issue with CGT 7.2.4 (7.3.8 also shows similar issues). I am working with a large 3rd party project. It has been developed for some time with "-O3 -g". Optimizing to "-O3" or "-O2" alone results in a runtime failure. "-O1", "-O3 -g --optimize_with_debug" work correctly. The goal is to take full advantage of optimization and run correctly. I don't see a significant improvement in cycle count with --optimize_with_debug. 

Is there a top down method to narrow down the problematic optimization and source code? Now I am trying to work backwards from the program error to guess what is broken. I am considering breaking the source in different sections to test compile option combinations. Is there a better method? Could I selectivly disable certain optimizations?

  • First, I encourage you to upgrade to the most recent version of the compiler that you can.  Details on that are here.

    I recommend you build all the source files with an option set (like -O3 -g) that works.  Then, one file at a time, build one file with the option set that fails (like -O3), and try it out.  If it works, that file is not the problem.  If it fails, then you found the source file with the issue.

    If that source file has many functions, you may wish to do the exercise again, but on a function by function basis.  You can change the build options for one function with the FUNCTION_OPTIONS pragma.  Look that up in the C6000 compiler manual.

    Thanks and regards,

    -George