Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1809 Wrong structure access with sdcc z80

closed-works-for-me
z80 port (190)
5
2011-07-14
2011-07-14
Mario Viara
No

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.

Discussion

  • Mario Viara
    Mario Viara
    2011-07-14

    Source , makefile, listing and sdcc version.

     
    Attachments
  • 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
    ret

    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).

    Philipp

    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.

     
    • 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
    Mario