A cast with a 16-bit result in r1 (MSB) and r0 (LSB) where the cast value comes from pdata generates code which overwrites the lower byte and gets a wrong upper byte:
r0 is used as address for the lower source byte. But after the lower byte has been stored in r0, r0 is incremented and then used as address to load the upper byte.
This can be reproduced by enabling the gcc-torture-execute-921202-2 regression test.
Philipp
This bug depends on the memory model. I can reproduce it in current SDCC #9875 using
Philipp
Last edit: Maarten Brock 2017-05-13
Fixed in revision [r9876].
Philipp
Last edit: Maarten Brock 2017-05-13