#322 dual dptr misuse

closed-works-for-me
Kevin Vigor
5
2003-01-31
2002-04-07
Karl Bongers
No

genPlus, genAssign load up result into
dptr1 while it is still being used as a pointer.

typedef struct {
int head_size;
//int mac_head_size;
int length;
int data_length;
PDBYTE buf; // ptr to start of ip
PDBYTE macbuf; // ptr to start of raw ethernet buf
} Ip_Data;

data word temp;
<cut>

void rx_icmp(Ip_Data XDATA *ip)
{
<cut>
LINE 1307: temp = ip->data_length/2;
LINE 1308: dbg_str(" dlen: ");

CODE GENERATED:
;
eth.c:1307: temp = ip->data_length/2;
;
genPlus
mov dptr,#_rx_icmp_ip_1_1
;
Swapped plus args.
movx a,@dptr
add a,#0x04
mov dpl1,a
inc dptr
movx a,@dptr
addc a,#0x00
mov dph1,a
inc dptr
movx a,@dptr
addc a,#0x00
mov dpx1,a
;
genPointerGet
;
genFarPointerGet
inc dps
movx a,@dptr
inc dptr
mov dpl1,a <--- dpl1 & dph1 in use, can't use!
movx a,@dptr
mov dph1,a
mov dps,#0
;
genAssign
;
genAssign: resultIsFar = TRUE
mov dptr,#__divsint_PARM_2
mov a,#0x02
movx @dptr,a
clr a
inc dptr
movx @dptr,a
;
genCall
;
genSend argreg = 1, size = 2
mov dpl,dpl1
mov dph,dph1
lcall __divsint
;
genAssign
;
genAssign: resultIsFar = FALSE
mov _temp,dpl
mov (_temp + 1),dph
;
eth.c:1308: dbg_str(" dlen: ");
;
genCall
;
genSend argreg = 1, size = 4
; Peephole 182b used 24 bit load of DPTR
mov dptr,#__str_0
mov b,#0x02
lcall _tx_str

Discussion

  • Kevin Vigor
    Kevin Vigor
    2003-01-31

    Logged In: YES
    user_id=11484

    I cannot reproduce this with the current CVS version. Please
    retest.

     
  • Kevin Vigor
    Kevin Vigor
    2003-01-31

    • assigned_to: nobody --> kvigor
    • status: open --> closed-works-for-me