I have a project that runs on a custom board that uses the Tiva TM4C129XNCADZ part. I have found what appears to be an optimization bug. If I set the optimization level to 1 (Local Optimizations) the issue appears. If I set the level to Off, the issue does not appear. I am using CCS 6.2.0.00050 with compiler version 15.12.3.LTS. (The issue also appeared on CCS version 6.1.1 with compiler 5.2.6). I have also reproduced this issue on the DK-TM4C129X.
The issue is that a variable that is passed to a function is corrupted by a call within the function before the passed variable is used. I have reduced my application to a minimal size that shows the bug. The project is attached and there are notes within the code as to where the problem is.
To see the issue:
- Grab a DK-TM4C129X.
- Create a workspace and load the attached project.
- Make sure TIVAWare 2.1.1.71 is installed (you may need to change the path within the project depending on where TivaWare is installed.
- Debug the project and run to the break point indicated in main and follow the comments.
Thanks,
Jeff