I know about works by Philipp Klaus Krause for removing 'enter frame' and 'leave frame' in functions. This is an old bug. It's present in SDCC 2.9.7 #5839, 3.0.2 #6489 and 3.2.1 #8087. But now I replay it on small piece of code.
sdcc -mz80 --code-loc 26000 --data-loc 0xF800 --no-std-crt0 --opt-code-size --funsigned-char -L z80 LaserDemo.c
generates for 'leave frame' this strange asm code:
I'm sure that it's bug because "ld sp,ix" here brokes SP by replacing with value of IX, that in process of working a function code can be absolutely random. And after this 'ret' returns to nowhere...
I want to say also that the bug is caused by set of coinciding parts of C constructions, since the other functions (with parameters, and without) have correct 'leave frame'.