Bugs item #1409955, was opened at 2006-01-19 15:58
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1409955&group_id=599
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: grasbon (grasbon)
Assigned to: Nobody/Anonymous (nobody)
Summary: Confused xdatas
Initial Comment:
Confused xdatas
Version:
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.4 #1191 (Jan 1 2006) (MINGW32)
Call:
"sdcc --stack-auto --noinduction Main.c"
The following main.c contains a bug difficult to spot.
Therefore have a look at the function WriteToXData(),
which places two bytes of a given array info byte 0 and
1 of the xdata space. The rest of the main-loop does
not make any sense - but we need the stuff because
without it, the bug will not appear.
So what's the problem? In the main-loop the
WriteToXData() is called repeatedly. Normally every
time the same thing is done: The values 0xab and 0xcd
will be placed into byte 0 und 1 of the xdata space.
But this is not work correctly. Sometimes, 0xcd, 0xab
will be placed, sometimes correct values 0xab, 0xcd are
stored.
Here's the Main.c:
-------------------------
void
WriteToXData(char* buffer)
{
*((xdata char*)0) = buffer[0];
*((xdata char*)1) = buffer[1];
}
void
main(void)
{
char a;
xdata char* p;
char d[5];
d[0] = 0;
d[1] = 0;
d[2] = 0;
d[3] = 0;
d[4] = 0;
p = 0;
do
{ if( (unsigned short)p > 10 ) a = 10-(char)p;
else a = 60;
d[0] = 0xab;
d[1] = 0xcd;
WriteToXData(d); // Watch the xdata: 0, 1!
p += a;
} while( p );
d[0] = 1;
d[1] = 2;
d[2] = 3;
d[3] = 4;
d[4] = 5;
}
-------------------------
Greetings,
Reimar Grasbon
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1409955&group_id=599
|