<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Recent changes to 1181: Bad code generated for *x = 0 where x is an xdata short ptr</title><link>http://sourceforge.net/p/sdcc/bugs/1181/</link><description>Recent changes to 1181: Bad code generated for *x = 0 where x is an xdata short ptr</description><language>en</language><lastBuildDate>Tue, 08 Aug 2006 15:13:41 -0000</lastBuildDate><item><title>Bad code generated for *x = 0 where x is an xdata short ptr</title><link>http://sourceforge.net/p/sdcc/bugs/1181/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;sdcc svn4321, command line:&lt;br /&gt;
sdcc -c -mmcs51 --model-small --debug -I. --xram-size &lt;br /&gt;
1024 --code-size 16384 -o t.rel t.c&lt;/p&gt;
&lt;p&gt;See the attached test case. I could not slim it down &lt;br /&gt;
more, as removing any of the remaining element &lt;br /&gt;
apparently causes the register pressure to drop to &lt;br /&gt;
the point where this bug is not exhibited.&lt;/p&gt;
&lt;p&gt;The problem lies in the s.c-&amp;gt;s = 0; statement, where &lt;br /&gt;
the compiler stomps itself over the dptr (dpl) &lt;br /&gt;
register.&lt;/p&gt;
&lt;p&gt;119 ;       t.c:26: &lt;br /&gt;
s.c-&amp;gt;s = 0;&lt;br /&gt;
120 ;       genAssign&lt;br /&gt;
121 ;       genPlus&lt;br /&gt;
0008 90s00r00            122         mov   &lt;br /&gt;
dptr,#_s&lt;br /&gt;
000B E0                  123         movx  &lt;br /&gt;
a,@dptr&lt;br /&gt;
000C 24 03               124         add   &lt;br /&gt;
a,#0x03&lt;br /&gt;
000E F5 82               125         mov     dpl,a&lt;br /&gt;
0010 A3                  126         inc     dptr&lt;br /&gt;
0011 E0                  127         movx  &lt;br /&gt;
a,@dptr&lt;br /&gt;
0012 34 00               128         addc  &lt;br /&gt;
a,#0x00&lt;br /&gt;
0014 F5 83               129         mov     dph,a&lt;br /&gt;
130 ;       genPointerSet&lt;br /&gt;
131 ;   &lt;br /&gt;
genFarPointerSet&lt;br /&gt;
132 ;       Peephole 181  &lt;br /&gt;
changed mov to clr&lt;br /&gt;
0016 E4                  133         clr     a&lt;br /&gt;
0017 F0                  134         movx  &lt;br /&gt;
@dptr,a&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Thomas Sailer</dc:creator><pubDate>Tue, 08 Aug 2006 15:13:41 -0000</pubDate><guid>http://sourceforge.netecf8b61f2713ce0c373a3f15f09f54648cf10632</guid></item></channel></rss>