#1941 pointer assignment code size regression

closed-out-of-date
MCS51
5
2016-04-13
2012-02-14
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
     
  • Ben Shi

    Ben Shi - 2016-01-15

    Maybe we can try to remove or merge redundant casts in the front end first.

     
  • Philipp Klaus Krause

    • status: open --> closed-out-of-date
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    The original code is not compileable, and it is not clear how to extend it to something compileable that reproduces the code size regression (will depend on how the pointer is used later). Please reopen with a compileable example, if this still applies

    Philipp

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks