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
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
Fixed by merging the branch.
Philipp