A top-level handler function supports 6 cases. One case is meant to enter a specific handler routine that contains a simple while(1){} trap. With optimization, this specific handler is omitted from the code and the case condition likewise omitted from the top-level switch statement.
In building a simplified test scenario, I have represented the other 5 handler routines and under certain scenarios, all specific handlers are omitted from the final build with optimization turned on. Without optimization, all cases are exercised in this test scenario and the while(1) trap functions as expected.
Optimization Level 2 - Global and 2 for speed/size. However, all first-level settings other than optimization-off cause problems. No advanced optimization settings have been utilized.
What is the recommended response to this observation? Any settings to the current compiler that would yield expected results? Would an updated compiler revision yield expected results?
Please provide reference to this being expected behavior with optimization enabled. The behavior is changing the nature of the natural code and providing unpredictable functionality.
Compiler:
TI v18.12.4.LTS
ti-cgt-arm_18.12.4.LTS