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.
Tool/software: TI C/C++ Compiler
hi,
I have a code which runs on a C5509A platform with CCS Version: 8.1.0.00011. The problem i am facing is that with the O3 level turned on for the project, some of the 'switch/case' statements are not getting executed. For example, i have something like:
switch(message id){
case 1:
....
break;
case 2:
switch(header){
case 6: macro stmnt
case 12: macro stmnt
....
case 42:
case 48: macro stmnt
default: send nack
}
Case 10:
default:
}
Even if the header=48, in case2, the control never hits the case48 code, but instead goes to default which is right next to it(send nack). If i turn off optimization, it works as expected. Another observation is that if i add another dummy case statement after case 48 (with optimization), then also it works. The macro statements are actually function call with different parameters, and from the dis-assembly i can see that the macro statement for case 48 has not been replaced with function call as it should be and like other case statements.
Has anyone seen or experienced this before? Why the compiler/optimizer ignores this specific last case statement?
Regards,
Dileepan.
For the source file which contains the problem switch statement, please follow the directions in the article How to Submit a Compiler Test Case. If it is not obvious which switch statement causes the problem, mark it by adding the comment // PROBLEM HERE.
Thanks and regards,
-George
Hi George,
Thanks for your response. I need to find out what is the best way to share the source code within the IP related constraints.
If that doesnt work out, i will try to create a test stub which manifests the problem and share it with you.
Thanks,
Regards,
Dileepan.
Hi George,
I spend some time in analyzing this issue and it looks like it is caused by one of the registers not being context saved, and once i pushed the relevant register to the stack, the problem is not seen.
Thanks a lot for your support,
Regards,
Dileepan.