#1809 Wrong structure access with sdcc z80

z80 port (188)
Mario Viara

When two different member of one structure accessed with a pointer are set to the same value the offset of the second member is wrong because is not calculated from the beginning of the structure but from the address of the previous accessed member.


  • Mario Viara

    Mario Viara - 2011-07-14

    Source , makefile, listing and sdcc version.

  • Philipp Klaus Krause

    I cannot reproduce this bug: The following code id generated for me:

    push ix
    ld ix,#0
    add ix,sp
    ;bug1.c:29: ptr->rd =

    ld c,4 (ix)
    ld b,5 (ix)
    ld e,c
    ld d,b
    inc de
    inc de
    inc de
    ;bug1.c:32: ptr->wr = 0;

    ld hl,#0x0004
    add hl,bc
    ld (hl),#0x00
    ld a,#0x00
    ld (de),a
    pop ix

    ptr is stored into bc. ptr + 3 is stored into de, ptr + 4 is stored into hl, then 0 is assigned to (hl) and (de).


    P.S.: --stack auto doesn't do anything int the z80 port.

    P.P.S.: I used sdcc 3.0.4 #6622 for testing, which version did you use? Please check with current sdcc and reopen the bug if you can reproduce the problem.

  • Philipp Klaus Krause

    • assigned_to: nobody --> spth
    • status: open --> closed-works-for-me
  • Mario Viara

    Mario Viara - 2011-07-14

    The string id of SDCC is attached in the file named sdcc and reported below. Now i try to use version 3.04


Log in to post a comment.