Re: [cc65] Re: possible error?

From: Johan Kotlinski <kotlinski1gmail.com>
Date: 2009-07-29 20:38:52
Another (very similar) problem example...

extern char foo[4];
void setfoo(char a)
{
    foo[2] = a;
}

2.19.9:

.proc   _setfoo: near
    lda     #<(_foo)
    ldx     #>(_foo)
    jsr     pushax
    ldy     #$02
    ldx     #$00
    lda     (sp),y
    ldy     #$02
    jsr     staspidx
    jsr     incsp1
    rts

v2.19.0:
.proc   _setfoo: near
    ldy     #$00
    ldx     #$00
    lda     (sp),y
    sta     _foo+2
    jsr     incsp1
    rts

...and couldn't the last jsr/rts pair be changed to a jmp?

Sorry, I will stop writing more for now :)

Thanks,
Johan

On Wed, Jul 29, 2009 at 8:23 PM, Johan Kotlinski<kotlinski@gmail.com> wrote:
>> By the way, if I declare foo as extern char* instead of extern
>> char[4], v2.12.0 produces much worse code:
>
> Please ignore that comment... of course the code has to be less
> efficient if foo is a pointer that may change.
>
> Johan
>
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Jul 29 20:39:19 2009

This archive was generated by hypermail 2.1.8 : 2009-07-29 20:39:22 CEST