Originally discovered while compiling the devkitSMS Gameplay State Update benchmark for ColecoVision, but the attached standalone C reproducer has no devkitSMS dependency. The defect is in SDCC’s Z80 register allocator.
z80: live IY value is overwritten while accessing a global operand