#1439 Bad code when casting from code to generic ptr in 2.8.0 RC1

closed-fixed
5
2013-05-25
2008-03-20
Patryk
No

SDCC 2.8.0 RC1 #5082 (also #5108) generates incorrect code, was OK in 2.7.4 #4972. Third byte of generic pointer is set incorrectly (0 - XDATA) or not set at all (f2() call). There are other places in my sources where it is copied from B register that is not set before. This bug may be related to
#1839277: Implicit typecast from code to generic pointer is wrong

void f1(char c, const void * p);
void f2(const void * p);
void g(void)
{
f1(5, (code void *)0x1234);
f2((code void *)0x1234);
}

mov _f1_PARM_2,#0x34
mov (_f1_PARM_2 + 1),#0x12
mov (_f1_PARM_2 + 2),#0x00
mov dpl,#0x05
lcall _f1
mov dptr,#0x1234
ljmp _f2

SDCC version:
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.8.0 #5082 (Mar 9 2008) (MINGW32)

command line:
sdcc.exe -c --debug --use-stdout -V --std-sdcc99 -I... Source7.c

WXP HE PL SP2, AMD Athlon XP 1700+

Discussion

  • Borut Ražem

    Borut Ražem - 2008-03-20

    Logged In: YES
    user_id=568035
    Originator: NO

    This bug was introduced in svn revision #5009 as side effect of fixing bug #1281583: code pointer array referencing

    Maarten, can you take a look ASAP?

    Borut

     
  • Maarten Brock

    Maarten Brock - 2008-03-20
    • assigned_to: nobody --> maartenbrock
     
  • Maarten Brock

    Maarten Brock - 2008-03-20
    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Maarten Brock

    Maarten Brock - 2008-03-20

    Logged In: YES
    user_id=888171
    Originator: NO

    Fixed in revision #5109.

     
  • Patryk

    Patryk - 2008-03-28

    Logged In: YES
    user_id=1788180
    Originator: YES

    I confirm: every place affected by this bug in my code is now (RC2 - #5117) compiled properly: same result as with #4972.

     

Log in to post a comment.