Menu

#2542 Cast overwrites lower byte of 16-bit result (andgets wrong upper byte)

closed-fixed
None
MCS51
7
2017-04-10
2016-08-26
No

A cast with a 16-bit result in r1 (MSB) and r0 (LSB) where the cast value comes from pdata generates code which overwrites the lower byte and gets a wrong upper byte:

r0 is used as address for the lower source byte. But after the lower byte has been stored in r0, r0 is incremented and then used as address to load the upper byte.

This can be reproduced by enabling the gcc-torture-execute-921202-2 regression test.

Philipp

Discussion

  • Philipp Klaus Krause

    • Priority: 5 --> 7
     
  • Philipp Klaus Krause

    This bug depends on the memory model. I can reproduce it in current SDCC #9875 using

    • Medium model
    • Large model with stack auto
    • stack auto

    Philipp

     

    Last edit: Maarten Brock 2017-05-13
  • Philipp Klaus Krause

    • status: open --> closed-fixed
    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    Fixed in revision [r9876].

    Philipp

     

    Last edit: Maarten Brock 2017-05-13

Log in to post a comment.

Monday.com Logo