#1849 Z80 port generating invalid asm with new register allocator

closed-fixed
z80 port (188)
5
2011-09-18
2011-09-17
No

For the attached function, sdcc #6854 generates invalid asm code for additions in the z80 port (other ports, such as gbz80 are not affected). The problem goes away when suing --oldralloc. Resulting in assembler errors "Error: <a> machine specific addressing or addressing mode error".

The invalid isntructions are of the following types:
ld a,iyl
ld a,iyh
(undocumented instructions sdcc should currently not emit)
add hl,iy
(I don't know any Z80 variant that would allow this)

To reproduce, compile the attached code using sdcc -mz80 --std-c99 test.c.

Philipp

Discussion

  • Sample code to reproduce the issue.

     
    Attachments
    • assigned_to: nobody --> spth
    • status: open --> closed-fixed
     
  • This problem was essentially caused by #3152684 . However, for the sake of robustness of regsiter allocation, it has been fixed by a workaround there. Once #3152684 is fixed, register allocation can give warnigns when it detects unconnected CFG or live-ranges.

    Fixed in sdcc revision #6857.

    Philipp