<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Bug in debugger or compiler?</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/14789/bug-in-debugger-or-compiler</link><description> I have a slight problem with the following code: 
 
 
unsigned char code * code x[] = {&amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot;};

void main() {

	unsigned char a;

	for(;;) a = x[0][0];
}
 
 
The device used is the Philips 8xC51MB2. After building it and starting a debug session</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Bug in debugger or compiler?</title><link>https://community.arm.com/thread/54280?ContentTypeID=1</link><pubDate>Fri, 22 Mar 2002 19:43:31 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2b0a2ec6-fee8-4b43-a02a-cd2d9d2c9c4b</guid><dc:creator>Andrew Neil</dc:creator><description>&lt;p&gt;The compiler is quite likely to have optimised your code: you assign values to &amp;#39;a&amp;#39; in the loop, but never use those values - therefore the compiler considers this to be &amp;quot;dead&amp;quot; code, and removes it!&lt;br /&gt;
&lt;br /&gt;
Try making &amp;#39;a&amp;#39; &lt;b&gt;volatile&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bug in debugger or compiler?</title><link>https://community.arm.com/thread/38540?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2002 03:19:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6a403546-6682-431c-b449-cadf762d8521</guid><dc:creator>Graham Cole</dc:creator><description>&lt;p&gt;I have found that sometimes the watch window can give misleading information and this turns out to be due to optimisation. It may be that some optimisation is possible with the Philips 8xC51MB2 that is not possible with the 8xC52. &lt;br /&gt;
&lt;br /&gt;
You may have to study the acual assembly code to see if this is the case. Try lowering the level of optimisation to see if that makes any difference.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>