Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1941 pointer assignment code size regression

open
nobody
5
2012-02-14
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