AnsweredAssumed Answered

CW removes dead code that shouldn't be dead.

Question asked by Matthew Smith on Dec 21, 2012
Latest reply on Dec 22, 2012 by Matthew Smith

Help, help, I'm being repressed! Er, optimised   This is CodeWarrior 10.2, target is HCS08.

 

For some reason, when I follow a loop with another loop, subsequent loops are getting optimised out, with a message "...ProcessorExpert.c:70:warning:C5660 Removed dead code"


Here is a sample of my code:


/* Write your code here */

/* For example: for(;;) { } */

for(;;)

{

  for (i=1; i<=255; i++)

  {

    LED1R_SetRatio8(i); 

    LED2G_SetRatio8(255-i);

    WAIT1_Waitms(5);

  }

  

  for (i=1; i<=255; i++)

  {

    LED2B_SetRatio8(i); 

    LED1R_SetRatio8(255-i);

    WAIT1_Waitms(5);

  }

}


Why am I not able to have subsequent loops?

 

Outcomes