The following code should print 0, but instead it prints 4096.
uint8 buffer ;
buffer = 0;
If, instead, I declare the buffer to be in XDATA space (
uint8 XDATA buffer ), then it does the right thing.
I tracked the problem down and it seems to be a bug in
_gptrget, which is called by
strlen. It looks like it's not doing the right thing with pointers to PDATA (seems to overwriting the DPH register with 0?)
I've attached the relevant source files.
I am using SDCC 3.2.0
_gptrget.c (8.89 KB)
_strlen.c (2.28 KB)