Simon Chamlian

Compiler bug

Discussion created by Simon Chamlian on Feb 17, 2010
Latest reply on Feb 18, 2010 by CrasyCat



I recently update my CodeWarrior compiler with a latest patch.


As a consequence to this, re-compiling previous release codes resulted in a different checksum and size. Be aware of this issue if your process replies on checksum to validate images.


The second and more important problem is that there seems to be a bug in the new patch: In the following code:




//code1if( (msa_err==MSA_STS_MODULE_BUSY ||      msa_err==MSA_STS_STILL_PROCESSING)              && (count <= 5)){       // Increment    count++;       // delay    //…    // Do Something    printfUART(1,"DELAY msa_err(0x%X), count==%d",msa_err, count);}printfUART(1,"msa_err(0x%X), count==%d",msa_err, count);



The body of the if statement never executes (when condition is true) and count remains 0.



If I replace the code with


//code2int b1= (msa_err==MSA_STS_MODULE_BUSY ||         msa_err==MSA_STS_STILL_PROCESSING);int b2= (count<= 5);int b3 = b1 && b2;if(b3){    // same a sabove}


 It works well.

This has been observed with Level1 optimization.


  • With No Optimizationl, code1 works.
  • The code size increased by 7% by turning optimization off.
  • Prior to the patch, code1 worked well with Level1 optimization.


Attached is a list of plugins.