Hi, all:
Our platform is MPC5604 chip. We use codewarrior IDE(Version is "5.9.0") to build our project. In build process, we found a problem.
1. Problem description
The code is shown below:
Fig.1 operating result
In the code, variable named "local_A" is always equal to 1, the PC pointer can't jump into the branch.
But actually the judgement condition is false, the PC pointer is still jump into the branch. you can see the result in Fig.1.
2. Problem analysis
We analysis the assemble code and found no error with the code. so we analysis the build options.
at last, we found there is a parameter can lead to this problem. The parameter is "Global Optimization Settings".
Fig.2 Faster build option
If this Global Optimization Settings is set as Fig.2 or optimization level is less than 4, the problem will reappear.
Fig.3 smaller code size build option
Only this Global Optimization Settings is set as Fig.3. The problem will never happen.
3. Question
1)we don't know the mechanism. If we configure the optimization setting as Level4, does it lead other new problems?
2) why other levels lead this problem?
Thank you for your reply.
Hi,
could you please share the code of the function, where variable local_A is declared or defined? I also do not see any operations with this variable (something like increment or another mathematical operation).
Regards,
Martin
Hi, Martin:
The variable local_A is declared as global variable. The code is below:
There is no modification about this variable in our code. so the value of this variable is always initial value "1".
In debug mode, the value of this variable is actually "1".
Thanks for your reply.
Regards,
Bryce
Hi Bryce,
this behavior is strange. Could you please share your project? If it not possible for you to share you project in public, please submit a new case for NXP support and I will answer you. But without your project I am not able to tell you what is wrong.
Regards,
Martin
Dear Martin,
I create a new case. shown below:
Thanks for your help.