Menu

#2911 ez80 compiler generating invalid asm

closed-fixed
None
Z80
5
2019-06-24
2019-05-30
Alan Cox
No
00338$:
        jp      P, 00109$
;col.c:189: if (*argv[i] != '-') {
        ld      l, e
        ld      h, d
        add     hl, hl
        add     hl, bc
        ex      (sp), hl
        ld      hl, -2 (ix)
        ld      a,(hl)
        ld      hl,a
        sub     a, #0x2d
        jr      Z,00102$

Note the ld hl,a

This appears in various places when I try and build the Fuzix user space with the head of the tree (29th May)

Discussion

  • Philipp Klaus Krause

    Do you have a small, compileable code sample to reproduce the issue?

     
  • Alan Cox

    Alan Cox - 2019-06-06

    Not yet. Will try and work on that this weekend.

     
  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
    • Category: other --> Z80
     
  • Philipp Klaus Krause

    This might be the same as bug #2914. Posting the above .asm snipped with --fverbose-asm would show if that is true.

    Philipp

     
  • Philipp Klaus Krause

    Received by private maiL:

    Sending the updated to the ez80 report here because sourceforget is broken
    again

    With --fverbose-asm

    ; AOP_STK for _main_sloc4_1_0
    ld -6 (ix), bc
    ;decomp16.c:314: for (k = 1; k < argc; k++) {
    ; genAssign
    ;fetchPairLong
    ;fetchLitPair
    ld de, #0x0001
    ; genAssign
    ; AOP_STK for
    ; AOP_STK for _main_sloc5_1_0
    ld a, 4 (ix)
    ld -2 (ix), a
    ld a, 5 (ix)
    ld -1 (ix), a
    ; genLabel
    00203$:
    ; genCmpLt
    ; AOP_STK for _main_sloc5_1_0
    ld a, e
    sub a, -2 (ix)
    ld a, d
    sbc a, -1 (ix)
    jp PO, 00487$
    xor a, #0x80
    00487$:
    jp P, 00122$
    ;decomp16.c:315: if (argv[k][0] == '-') {
    ; genLeftShift
    ;fetchPairLong
    ld l, e
    ld h, d
    add hl, hl
    ; genPlus
    ; AOP_STK for _main_sloc0_1_0
    ;fetchPairLong
    ld bc, -10 (ix)
    add hl, bc
    ; genPointerGet
    ;fetchPairLong
    ; genPointerGet
    ld a,(hl)
    ld hl,a
    ; peephole 103 load value in a first and use it next
    ; genCmpEq
    sub a, #0x2d
    ; peephole 81 removed jp by using inverse jump logic
    ; peephole 158 removed unused label 00488$.
    jp NZ,00204$
    ; peephole 82 removed jp by using inverse jump logic
    ; peephole 158 removed unused label 00489$.
    ;decomp16.c:316: c = argv[k][1];
    ; genPlus
    inc hl
    ; genPointerGet
    ld c, (hl)
    ;decomp16.c:317: switch (c) {
    ; genCmpEq
    ; peephole 81 removed jp by using inverse jump logic
    ; peephole 158 removed unused label 00490$.
    ; genCmpEq
    ld a,c
    cp a,#0x30
    jr Z,00115$
    ; peephole 163 changed absolute to relative conditional jump.
    ; peephole 107 removed load from c into a by replacing sub with cp
    ; peephole 81 removed jp by using inverse jump logic
    ; peephole 158 removed unused label 00491$.
    ; genCmpEq
    ; peephole 81 removed jp by using inverse jump logic
    ; peephole 158 removed unused label 00492$.
    ; genCmpEq
    cp a,#0x31
    jr Z,00115$
    ; peephole 163 changed absolute to relative conditional jump.
    ; peephole 108 removed load from c into a by replacing sub with cp
    cp a,#0x32
    jr Z,00115$
    ; peephole 163 changed absolute to relative conditional jump.
    ; peephole 107 removed load from c into a by replacing sub with cp
    ; peephole 81 removed jp by using inverse jump logic
    ; peephole 158 removed unused label 00493$.
    ; genCmpEq
    ; peephole 81 removed jp by using inverse jump logic

    Indicating that this is indeed the same issue as bug #2914, and thus fixed in [r11295].

    Philipp

     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB