This code doesn't return if compiled with sccz80 (Most Recent Official Release currently v1.99C dated 19 Jan 2019)
If compiled with sdcc it returns.
If compiled with char (removed unsigned) it returns.
Asm generated: ._main
push bc
push bc
push bc
push bc
dec sp
ld hl,0 ;const
add hl,sp
ld (hl),#(6 % 256 % 256)
ld hl,5 ;const
add hl,sp
ex de,hl
ld hl,2 ;const
add hl,sp
ld a,(hl)
ld (de),a
ld hl,5 ;const
add hl,sp
ld e,(hl)
ld d,0
pop hl
push hl
ld h,0
call l_ne
jp nc,i_2
.i_3
jp i_3
.i_4
.i_2
inc sp
pop bc
pop bc
pop bc
pop bc
ret
I think that this is issue: https://github.com/z88dk/z88dk/issues/1126 - basically an issue in the optimisation rules that resulted in the wrong stack offset being calculated and hence the wrong value being tested against.