Menu

#3097 HL-allocated result of expression is not transferred into static variable correctly

closed-fixed
None
Z80
5
2020-08-12
2020-08-10
Tony Pavlov
No

this bug was introduced in r11806, here is my comment:
https://sourceforge.net/p/sdcc/feature-requests/699/#93cf/df3c

i also managed to make an example that shows the generation of invalid code.
ver:

SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ez80_z80/z80n/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.0.3 #11806 (MINGW64)

cmdline:

sdcc -mgbz80 --fsigned-char --no-std-crt0 -I ..\..\gbdk\include -I ..\..\gbdk\include\asm -I src\include -c --max-allocs-per-node 50000 --no-peep test4.c -o build\test4.rel

result:

    ld  a, (hl)
    inc hl
    ld  h, (hl)
    ld  l, a
    ld  e, #0x00
    ld  hl, #_scene_to_map_x_65536_4
    ld  (hl), h

instead of:

    ld  a, (hl)
    inc hl
    ld  h, (hl)
    ld  l, a
    ld  e, h
    ld  d, #0x00
    ld  hl, #_scene_to_map_x_65536_4
    ld  (hl), e

in 4.0.3 #11800 (MINGW64)

suggested code should be:

    ld    e, h
    ld    hl, #_scene_to_map_x_65536_99
    ld    (hl), e
1 Attachments

Discussion

  • Philipp Klaus Krause

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

    • status: open --> closed-fixed
     
  • Philipp Klaus Krause

    Fixed in [r11818].
    When --reserve-regs-iy was specified, the bug also affected z80-related ports other than gbz80.

     
    • Tony Pavlov

      Tony Pavlov - 2020-08-12

      wow! thank you!

       

Log in to post a comment.

Monday.com Logo