<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>CodeWarrior for MCUのトピックCW removes dead code that shouldn't be dead.</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-removes-dead-code-that-shouldn-t-be-dead/m-p/216171#M8518</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Help, help, I'm being repressed! Er, optimised &lt;SPAN aria-label="Wink" class="emoticon-inline emoticon_wink" style="height:16px;width:16px;"&gt;&lt;/SPAN&gt;&amp;nbsp; This is CodeWarrior 10.2, target is HCS08.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;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"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;Here is a sample of my code:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;/* Write your code here */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/* For example: for(;;) { } */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;for(;;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; for (i=1; i&amp;lt;=255; i++)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LED1R_SetRatio8(i);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LED2G_SetRatio8(255-i);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WAIT1_Waitms(5);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; for (i=1; i&amp;lt;=255; i++)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LED2B_SetRatio8(i);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LED1R_SetRatio8(255-i);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WAIT1_Waitms(5);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Why am I not able to have subsequent loops?&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Dec 2012 22:45:36 GMT</pubDate>
    <dc:creator>Smiffytech</dc:creator>
    <dc:date>2012-12-21T22:45:36Z</dc:date>
    <item>
      <title>CW removes dead code that shouldn't be dead.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-removes-dead-code-that-shouldn-t-be-dead/m-p/216171#M8518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Help, help, I'm being repressed! Er, optimised &lt;SPAN aria-label="Wink" class="emoticon-inline emoticon_wink" style="height:16px;width:16px;"&gt;&lt;/SPAN&gt;&amp;nbsp; This is CodeWarrior 10.2, target is HCS08.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;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"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;Here is a sample of my code:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;/* Write your code here */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;/* For example: for(;;) { } */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;for(;;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; for (i=1; i&amp;lt;=255; i++)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LED1R_SetRatio8(i);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LED2G_SetRatio8(255-i);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WAIT1_Waitms(5);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; for (i=1; i&amp;lt;=255; i++)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LED2B_SetRatio8(i);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LED1R_SetRatio8(255-i);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; WAIT1_Waitms(5);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt; line-height: 1.5em;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Why am I not able to have subsequent loops?&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2012 22:45:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-removes-dead-code-that-shouldn-t-be-dead/m-p/216171#M8518</guid>
      <dc:creator>Smiffytech</dc:creator>
      <dc:date>2012-12-21T22:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: CW removes dead code that shouldn't be dead.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-removes-dead-code-that-shouldn-t-be-dead/m-p/216172#M8519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matthew,&lt;/P&gt;&lt;P&gt;Hint: pay close attention to compiler warning and information messages ;-).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assume your variable 'i' is of type unsigned char?&lt;/P&gt;&lt;P&gt;That means that the variable has a value range of 0..255 (0..0xff).&lt;/P&gt;&lt;P&gt;And if you do a comparison of 'i&amp;lt;=255' in the for() loop, this means that this condition is always TRUE.&lt;/P&gt;&lt;P&gt;As such, you should see a message C4000 Condition always is TRUE (unless you have switched off such messages).&lt;/P&gt;&lt;P&gt;Which means that your first loop never will finish.&lt;/P&gt;&lt;P&gt;:-).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Dec 2012 09:04:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-removes-dead-code-that-shouldn-t-be-dead/m-p/216172#M8519</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2012-12-22T09:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: CW removes dead code that shouldn't be dead.</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-removes-dead-code-that-shouldn-t-be-dead/m-p/216173#M8520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Erich! I didn't notice any other warnings, but I guess they may have been scrolled off the page.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now that you point out the error, yes, I can well see what I've done! That's the problem with not being used to typed languages - I've written tens of thousands of lines of Perl over the last few years, but very, very, little C - so it would have taken me a LONG time to spot that, if you hadn't pointed it out!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whilst I was waiting to see if anyone came up with an answer, I started testing something else - driving the LEDs by setting the PWM values and the delays between changing them from the output of an LFSR, which I generated the code for using &lt;A href="http://lfsr-generator.sourceforge.net/" title="http://lfsr-generator.sourceforge.net/"&gt;lfsr-generator&lt;/A&gt; - makes for some very groovy effects! (This project is actually wearable jewellery - LED effects triggered by an MMA7660 accelerometer, for which I am now working on the I2C code.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your continued support!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Dec 2012 22:11:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CW-removes-dead-code-that-shouldn-t-be-dead/m-p/216173#M8520</guid>
      <dc:creator>Smiffytech</dc:creator>
      <dc:date>2012-12-22T22:11:12Z</dc:date>
    </item>
  </channel>
</rss>

