Menu

#2814 Broken z80 peephole 10 (and corresponding r2k, tlcs90)

closed-fixed
nobody
None
other
5
2018-10-01
2018-09-20
No

A bug that results in wrong code being generated silently in SDCC 3.8.0 RC1 was found by z88dk:
https://github.com/z88dk/z88dk/issues/971#issuecomment-422968355

ld  a,(hl)
ld  hl,(_byte2)
ld  h,a

gets transformed to

ld h,(hl)
ld hl,(_byte2)

Apparently there is no known reproducer when compiling just with SDCC, but some of the z88dk peepholes result in code, which our peephole 10 then transforms incorrectly.

The attached patch should fix the issue.

Philipp

1 Attachments

Discussion

  • Philipp Klaus Krause

    The fix has been applied in the "next" branch, to be merged after the 3.8.0 release.

    It was discussed on the sdcc-devel list if the fix should be applied to trunk, but we decided that it is not worth the delay of the release.

    Philipp

     
  • Philipp Klaus Krause

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

    Fixed by merging the branch.

    Philipp

     

Log in to post a comment.