#1941 pointer assignment code size regression

open
nobody
MCS51
5
2015-07-21
2012-02-14
Gabriele Gorla
No

the following code:
__data unsigned char BUFFER[8];
__xdata unsigned char *ptr;
addr=(__xdata unsigned char *)(*((__data int *)&BUFFER[1]));

in sdcc 3.0 used to correctly compile to:
mov dpl,(_BUFFER + 0x0001)
mov dph,((_BUFFER + 0x0001) + 1)

in sdcc 3.1 compiles to:
mov r1,#(_BUFFER + 0x0001)
mov ar6,@r1
inc r1
mov ar7,@r1
mov dpl,r6
mov dph,r7

Discussion

  • Ben Shi
    Ben Shi
    2015-07-21

    • Category: --> MCS51